Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
87048 sh25_zhoumy 机器翻译 C++ 通过 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; }


测评信息: