QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86891 | #4830. Transfer of Duty | Maraschino | 0 | 38ms | 10812kb | C++17 | 944b | 2023-03-11 14:24:32 | 2023-03-11 14:24:34 |
Judging History
answer
#include <bits/stdc++.h>
using LL = long long;
FILE *fin, *fout, *ferr;
std::mt19937 gen(1919810);
static const int N = 100'005;
int n;
LL a[N];
std::map<LL, int> map;
char opt[N];
signed main()
{
std::uniform_int_distribution<LL> random(1, 1LL << 62);
fin = stdin, fout = stdout, ferr = stderr;
fscanf(fin, "%s", opt + 1);
LL tmp = 0;
if (opt[1] == 'r')
fscanf(fin, "%lld", &tmp);
fscanf(fin, "%d", &n);
for (int i = 1; i < N; ++i)
a[i] = random(gen), map[a[i]] = i;
for (int i = 1; i <= n; ++i)
{
static int x;
fscanf(fin, "%d", &x);
tmp ^= a[x];
if (tmp == 0)
fprintf(fout, "%d\n", 0);
else if (map.count(tmp))
fprintf(fout, "%d\n", map[tmp]);
else
fprintf(fout, "%d\n", -1);
}
if (opt[1] == 's')
fprintf(fout, "%lld\n", tmp);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 29ms
memory: 10812kb
input:
start 5 10 14 10 12 10
output:
10 -1 14 -1 -1 1556716062863899314
input:
resume 1556716062863899314 6 14 277 12 10 277 12
output:
-1 -1 -1 277 0 12
result:
ok
Test #2:
score: 100
Accepted
time: 38ms
memory: 10808kb
input:
start 1 1
output:
1 3150584247126582681
input:
resume 3150584247126582681 1 1
output:
0
result:
ok
Test #3:
score: 0
Stage 1: Program answer Runtime Error
input:
start 1 1000000