QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#568382#9320. Find the Easiest ProblemJOFISHWA 3ms10644kbC++231.6kb2024-09-16 16:14:382024-09-16 16:14:41

Judging History

你现在查看的是最新测评结果

  • [2024-09-16 16:14:41]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:10644kb
  • [2024-09-16 16:14:38]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

struct node{
	string a;
	char ti;
	string result;
}c[100000];

bool cmp(node x, node y){
	if(x.a.size() == y.a.size()){
		return x.a[x.a.size()-1] > y.a[y.a.size()-1];
	} else return x.a.size() > y.a.size();
}

int main(){
	int t;
	cin >> t;
	
	while(t--){
		int n, i;
		int *SUM = new int[26]();
		int *sum = new int[26]();
		cin >> n;
		for(i = 0; i < n; i++){
			string str, strr;
			char qq;
			int p = 1;
			cin >> c[i].a >> c[i].ti >> c[i].result;
		}
		sort(c, c+n, cmp);
		for(i = 0; i < n; i++){
			cout << c[i].a << endl;
		}
		for(i = 0; i < n; i++){
			if(c[i].result == "rejected")continue;
			if(i == 0){
					for(int j = 0; j < 26; j++){
						sum[j] = 0;
					}
				if(sum[c[i].ti - 'A'] == 0){
					SUM[c[i].ti - 'A']++;
					sum[c[i].ti - 'A'] = 1;
				}
			}else {
				if(c[i].a == c[i-1].a){
					if(sum[c[i].ti - 'A'] == 0){
						SUM[c[i].ti - 'A']++;
						sum[c[i].ti - 'A'] = 1;
					} else continue;
				}
				if(c[i].a != c[i-1].a){
					for(int j = 0; j < 26; j++){
						sum[j] = 0;
					}
					if(sum[c[i].ti - 'A'] == 0){
						SUM[c[i].ti - 'A']++;
						sum[c[i].ti - 'A'] = 1;
					}
				}
			}
		}
		int k = 0, l = 0;
		for(i = 0; i < 26; i++){
			if(SUM[i] > k) {k = SUM[i]; l = i;}
//			cout << SUM[i] << endl;
		}
		
		char s = l + 'A';
		cout << s;
		if(t != 0) cout << endl;
	}
	
	return 0;
}
//1
//9
//a A accepted
//b B accepted
//c A accepted
//a B accepted
//a C accepted
//b B accepted
//c C accepted
//c B accepted
//c C accepted

详细

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 10644kb

input:

2
5
teamA A accepted
teamB B rejected
teamC A accepted
teamB B accepted
teamD C accepted
4
teamA A rejected
teamB A accepted
teamC B accepted
teamC B accepted

output:

teamD
teamC
teamB
teamB
teamA
A
teamC
teamC
teamB
teamA
A

result:

wrong answer 1st lines differ - expected: 'A', found: 'teamD'