Run ID Author Problem Lang Verdict Time Memory Code Length Submit Time
87048 sh25_zhoumy 机器翻译 C++ Accepted 0 MS 256 KB 606 2026-04-10 15:30:32

Tests(2/2):


#include <iostream> #include <queue> #include <vector> using namespace std; int main() { int M, N; cin >> M >> N; queue<int> mem; vector<bool> exist(1001, false); int ans = 0; for (int i = 0; i < N; i++) { int word; cin >> word; if (exist[word]) { continue; } ans++; if (mem.size() == M) { int old = mem.front(); mem.pop(); exist[old] = false; } mem.push(word); exist[word] = true; } cout << ans << endl; return 0; }


Judgement Protocol: