Judging Troubles |
Time Limit: 5000ms, Special Time Limit:12500ms, Memory Limit:65536KB |
Total submit users: 84, Accepted users: 61 |
Problem 13352 : No special judgement |
Problem description |
|
Input |
The input consists of: |
Output |
Output one line with the maximum number of judging results that could have been the same for both systems. |
Sample Input |
5 correct wronganswer correct correct timelimit wronganswer correct timelimit correct timelimit |
Sample Output |
4 |
Problem Source |
NWERC 2014 |
Submit Discuss Judge Status Problems Ranklist |
题意就是看看给出的两个评测系统的n的结果,让你求有多少个是相同的提交
思路:字典序
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; struct node { char ch[20]; }; node ch1[100005],ch2[100005]; int comp(node a,node b) { return strcmp(a.ch,b.ch)<0; } int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%s",ch1[i].ch); sort(ch1,ch1+n,comp); //for(int i=0;i<n;i++) // cout<<ch1[i].ch<<endl; for(int j=0;j<n;j++) scanf("%s",ch2[j].ch); sort(ch2,ch2+n,comp); int i=0; int j=0; int cout=0; while(1) { int k=strcmp(ch1[i].ch,ch2[j].ch); //printf("!!! "); if(k==0) { cout++; i++; j++; if(i==n&&j==n) break; } else if(k<0) { i++; if(i==n) break; } else if(k>0) { j++; if(j==n) break; } } printf("%d ",cout); }