代码:
#include<iostream>
#include<stack>
#include<string.h>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<climits>
#include<cstdio>
#include<ctype.h>
using namespace std;
inline void mr(int& theNumberToRead) { theNumberToRead = 0; int prn = 1; char c = getchar(); while (!isdigit(c)) { if (c == '-')prn = -1; c = getchar(); }while (isdigit(c)) { theNumberToRead = 10 * theNumberToRead + c - 48; c = getchar(); }theNumberToRead *= prn; }
//上面的是快读和头文件之类的。。。不用细看
int n, m, t, ans, x, a[101];
bool b[1001];
int main()
{
mr(m);
mr(n);
m;
for (int i = 1; i <= n; ++i)
{
mr(x);
if (!b[x])
{
++ans, ++t;
b[x] = 1;
if (t > m)
{
t -= m;
b[a[t]] = 0;
}
a[t] = x;
}
}
printf("%d", ans);
return 0;
}
感觉很完美啊,为什么只有30分呢