关于NOIP T1
  • 板块学术版
  • 楼主gghack_Nythix
  • 当前回复0
  • 已保存回复0
  • 发布时间2023/11/19 22:37
  • 上次更新2023/11/20 13:32:59
查看原帖
关于NOIP T1
895690
gghack_Nythix楼主2023/11/19 22:37

我使用了不符合题面要求的算法获得了60分,第十个点AC。而符合题面要求的获得了90分,第十个测试点没过。求解答,急急急! 60pts:

#include<bits/stdc++.h>
#define int long long
#define rrg register 
using namespace std;
string last;
priority_queue<int,vector<int>,greater<int> >q;
int maxx[100005],minn[100005]; 
signed main(){
	// freopen("dict4.in","r",stdin);
	// freopen("dict4.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	for(rrg int i = 1;i <= n;++i){
		string x;
		cin >> x;
		sort(x.begin(), x.end());
		maxx[i] = x[x.size() - 1],minn[i] = x[0];
		q.push(x[x.size() - 1]);
	}
	if(m == 1){
		for(rrg int i = 1;i <= n;++i){
			if(minn[i] > q.top())cout << 0;
			else cout << 1;
		}
		return 0;
	}
	for(rrg int i = 1;i <= n;++i){
		if(minn[i] > q.top())cout << 0;
		else cout << 1;
	}
	return 0;
}
/*23 1 x w y l n e j d o t u z s b k h q f g i v c r*/

90pts

#include<bits/stdc++.h>
#define int long long
#define rrg register 
using namespace std;
string last;
priority_queue<int,vector<int>,greater<int> >q;
int maxx[100005],minn[100005]; 
signed main(){
	// freopen("dict4.in","r",stdin);
	// freopen("dict4.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n,m;
	cin >> n >> m;
	for(rrg int i = 1;i <= n;++i){
		string x;
		cin >> x;
		sort(x.begin(), x.end());
		maxx[i] = x[x.size() - 1],minn[i] = x[0];
		q.push(x[x.size() - 1]);
	}
	if(m == 1){
		for(rrg int i = 1;i <= n;++i){
			if(minn[i] > q.top())cout << 0;
			else cout << 1;
		}
		return 0;
	}
	for(rrg int i = 1;i <= n;++i){
		if(minn[i] >= q.top())cout << 0;//this
		else cout << 1;
	}
	return 0;
}
/*23 1 x w y l n e j d o t u z s b k h q f g i v c r*/
2023/11/19 22:37
加载中...