QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#322356#4830. Transfer of Dutyminhnhatnoe0 74ms11452kbC++14802b2024-02-06 21:58:112024-02-06 21:58:12

Judging History

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

  • [2024-02-06 21:58:12]
  • 评测
  • 测评结果:0
  • 用时:74ms
  • 内存:11452kb
  • [2024-02-06 21:58:11]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

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