QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#86891#4830. Transfer of DutyMaraschino0 38ms10812kbC++17944b2023-03-11 14:24:322023-03-11 14:24:34

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-11 14:24:34]
  • 评测
  • 测评结果:0
  • 用时:38ms
  • 内存:10812kb
  • [2023-03-11 14:24:32]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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

output:


input:


output:


result: