QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#322356 | #4830. Transfer of Duty | minhnhatnoe | 0 | 74ms | 11452kb | C++14 | 802b | 2024-02-06 21:58:11 | 2024-02-06 21:58:12 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
mt19937_64 rng(24);
const int MAXV = 1000001;
unsigned long long a[MAXV];
signed main(){
cin.tie(0)->sync_with_stdio(0);
for (int i=1; i<MAXV; i++) a[i] = rng();
sort(a + 1, a + MAXV);
string s; cin >> s;
unsigned long long state = 0;
if (s == "resume") cin >> state;
int n; cin >> n;
for (int i=0; i<n; i++){
int v; cin >> v;
state ^= a[v];
if (state == 0){
cout << "0";
continue;
}
auto it = lower_bound(a+1, a+MAXV, state);
if (it == a+MAXV || *it != state)
cout << "-1\n";
else
cout << (it - a) << "\n";
}
if (s == "start") cout << state << "\n";
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 74ms
memory: 11452kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 271305634971647
input:
resume 271305634971647 6 14 277 12 10 277 12
output:
-1 -1 -1 277 012
result:
wrong answer