AcWing 1204. 错误票据
原题链接
简单
作者:
让我AC吧球球了
,
2022-02-16 00:28:00
,
所有人可见
,
阅读 132
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<sstream>
using namespace std;
string line;
int n,n1;
const int N = 100010;
bool st[N];
int a[N];
int main(){
cin >> n;
int res1 = 0,res2 = 0;
getline(cin,line);
while(n--){
getline(cin,line);
stringstream ssin(line);
while(ssin>>a[n1]) n1++;
}
for(int i = 0;i<n1;i++){
if(st[a[i]] == true) res1 = a[i];
st[a[i]] = true;
}
int minv = 9999;
for(int i = 0;i < n1;i++){
if(minv >= a[i]) minv = a[i];
}
for(int i = minv;i<minv+n1;i++){
if(st[i] == false) res2 = i;
}
printf("%d ",res2);
printf("%d",res1);
return 0;
}