Judging Troubles(字典序)
2015-08-22 16:31
423 查看
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 |
The NWERC organisers have decided that they want to improve the automatic grading of the submissions for the contest, so they now use two systems: DOMjudge and Kattis. Each submission is judged by both systems and the grading results are compared to make sure that the systems agree. However, something went wrong in setting up the connection between the systems, and now the jury only knows all results of both systems, but not which result belongs to which submission! You are therefore asked to help them figure out how many results could have been consistent. |
Input |
The input consists of: ? one line with one integer n (1 ≤ n ≤ 10^5), the number of submissions; ? n lines, each with a result of the judging by DOMjudge, in arbitrary order; ? n lines, each with a result of the judging by Kattis, in arbitrary order. Each result is a string of length between 5 and 15 characters (inclusive) consisting of lowercase letters. |
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 |
思路:字典序
#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("!!!\n"); 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\n",cout); }
相关文章推荐
- UI-UIImageView
- 九宫图
- 《深入Java虚拟机第二版》读书笔记
- mysqldump工具的使用
- 灰度变换增强
- iOS-万能跳转界面方法 (runtime实用篇一) 字数733 阅读1080 评论28 喜欢51
- 控制台传入字符串用逗号隔开,判断是否是回文
- LeetCode2.1.5(Median of Two Sorted Arrays)
- 算法实现的复杂度计算
- 洛谷1023 税收与补贴问题 解题报告
- poj 2488 A Knight's Journey 【骑士周游 dfs + 记忆路径】
- 基本套接字编程
- HDU 1028 Ignatius and the Princess III
- leveldb学习:Env
- POJ 1584 A Round Peg in a Ground Hole(是否凸包 && 圆是否在凸包内)
- 线程入门(一)
- java并发编程---synchronized、Lock
- 第七集 最优间隔分类器问题
- 第七集 最优间隔分类器问题
- 字典序模版