Judging Troubles (multiset查找) 分类: ACM STL
2015-12-31 08:40
351 查看
Judging Troubles
Time Limit: 5000ms, Special Time Limit:12500ms, Memory Limit:65536KB
Total submit users: 91, Accepted users: 72
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
题意就是看看给出的两个评测系统的n的结果,让你求有多少个是相同的提交。
用multiset,也可以用map做
版权声明:本文为博主原创文章,未经博主允许不得转载。
Time Limit: 5000ms, Special Time Limit:12500ms, Memory Limit:65536KB
Total submit users: 91, Accepted users: 72
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
题意就是看看给出的两个评测系统的n的结果,让你求有多少个是相同的提交。
用multiset,也可以用map做
#include<stdio.h> #include<string.h> #include<set> #include<vector> #include<algorithm> #include<iostream> #include<string> #include<stdlib.h> #define maxn 100000+100 using namespace std; char str[maxn]; char ch[maxn]; string ss; int main() { int n; multiset<string>S; scanf("%d",&n); getchar(); for(int i=0;i<n;i++) { scanf("%s",str); S.insert(str); } //printf("%d\n",S.size()); int count=0; for(int i=0;i<n;i++) { scanf("%s",ch); multiset<string>::iterator it; it=S.find(ch); if(it!=S.end()) { count++; S.erase(it); } } printf("%d\n",count); return 0; } //map版本 #include<stdio.h> #include<string.h> #include<set> #include<vector> #include<algorithm> #include<iostream> #include<string> #include<stdlib.h> #include<map> #define maxn 100000+100 using namespace std; char str[maxn]; char ch[maxn]; string ss; int main() { int n; map<string,int>S; S.clear(); scanf("%d",&n); getchar(); for(int i=0;i<n;i++) { scanf("%s",str); S[str]++; } //printf("%d\n",S.size()); int count=0; for(int i=0;i<n;i++) { scanf("%s",ch) ; if(S[ch]>0) { count++; S[ch]--; } } printf("%d\n",count); return 0; }
版权声明:本文为博主原创文章,未经博主允许不得转载。
相关文章推荐
- Judging Troubles (multiset查找) 分类: ACM STL
- Joke with permutation 分类: ACM 2015-08-03 14:09 1
- HNU Knockout Racing 分类: ACM 2015-08-03 13:35 1人
- Crazy Search(POJ1200) 分类: poj 2015-07-25 10:15 6
- Delicious Apples(多校联合训练) 分类: ACM 多校 201
- 1080 两个数的平方和 分类: 51nod 2015-07-20 22:20 11人阅读
- 1066 Bash游戏 分类: 51nod 2015-07-20 22:15 5人阅读 评
- 1088 最长回文子串 分类: 51nod 2015-07-20 22:09 8人阅读 评
- 1083 矩阵取数问题 分类: 51nod 2015-07-20 22:05 9人阅读 评
- 1083 矩阵取数问题 分类: 51nod 2015-07-20 22:05 9人阅读 评
- 1009 数字1的数量 分类: 51nod 2015-07-20 21:44 3人阅读 评
- 51nod 1091 线段的重叠 分类: 51nod 2015-07-18 21:49 7人阅读
- LoadRunner常用函数
- Request.url用法
- center
- iOS 开发如何获取当前的应用版本号
- relative 和 absolute
- 自定义View的XML报错问题
- 猿题库 iOS 客户端架构设计-唐巧
- window与linux文件传输工具