题目链接:https://www.luogu.com.cn/problem/P8598
注意输入
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#define PII std::pair<ll,ll>
#define ll long long
//ll n;
ll dx[] = {0,0,1,-1};
ll dy[] = {1,-1,0,0};
const ll N = 1e3 + 500;
ll dp[N][N];
const ll mod = 100000007;
void solve(){
ll a;
ll n;
std::cin >> n;
ll re = 0;
std::vector<ll> op;
while(std::cin >> a){
op.push_back(a);
}
ll aa = 0,bb = 0;
std::sort(op.begin(),op.end());
// for(ll i = 1; i <= n; i ++){
// std::cout << op[i] << " ";
// }
// std::cout << "\n";
ll kk = 0;
for(auto jj : op){
re ++;
if(re == 1){
kk = jj;
continue;
}
else{
if(kk + 1 == jj) kk = jj;
else{
if(kk == jj) bb = kk;
else aa = kk + 1;
kk = jj;
}
}
}
std::cout << aa << " " << bb << "\n";
return ;
}
int main(){
ll t = 1;
// std::cin >> t;
while(t --)
solve();
return 0;
}