#include<iostream>
#include<vector>
#include<map>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<string>
#include<stack>
#include<set>
using namespace std;
int flag[10010];
queue<int> tmpres;
int main()
{
// freopen("test.txt", "r", stdin);
int n, tmp, res = -1;
scanf("%d", &n);
for (int i = 0; i < n; ++i)
{
scanf("%d", &tmp);
if (flag[tmp] == 0) {
flag[tmp]++;
if(res!=-1)
tmpres.push(tmp);
else res = tmp;
}
else {
flag[tmp]++;
while (!tmpres.empty()&&flag[tmpres.front()] > 1)tmpres.pop();
if (res == tmp) {
if (!tmpres.empty())
{
res = tmpres.front();
tmpres.pop();
}
else {
res = -1;
}
}
}
}
if (res == -1)cout << "None";
else cout << res;
return 0;
}
题目很简答,只是我觉得这是我这几天以来写的最漂亮的代码了,所以放上来自我安慰