Submission #571861

# Submission time Handle Problem Language Result Execution time Memory
571861 2022-06-02T22:16:00 Z RandomLB Data Transfer (IOI19_transfer) C++17
100 / 100
99 ms 2512 KB
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
#define siz(x) (int)x.size()
 
vi get_attachment(vi v){
    int xr = 0;
    for (int i = 0; i < siz(v); i++) xr ^= (i+1)*v[i];
    int on = 0;
 	vi res;
    for (int i = 0; i < __lg(siz(v)+1); i++){
        res.push_back(xr&(1<<i)?1:0);
        if (xr&(1<<i)) on ^= 1;
    }
    res.push_back(on);
    return res;
}
 
vi retrieve(vi v){
    int n = (siz(v) < 100? 63 : 255);
    int xr = 0;
    vi res;
    for (int i = 0; i < n; i++){
        xr ^= (i+1)*v[i];
        res.push_back(v[i]);
    }
    int check = 0;
    for (int i = 0; i < __lg(n+1); i++) if (v[n+i]) check ^= (1<<i);
    //cout << xr << " " << check << "\n";
    if (xr != check && __builtin_popcount(check)%2 == v.back()) res[(xr^check)-1] ^= 1;
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 640 KB Output is correct
2 Correct 5 ms 640 KB Output is correct
3 Correct 3 ms 652 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 732 KB Output is correct
6 Correct 3 ms 636 KB Output is correct
7 Correct 3 ms 648 KB Output is correct
8 Correct 4 ms 648 KB Output is correct
9 Correct 4 ms 640 KB Output is correct
10 Correct 3 ms 640 KB Output is correct
11 Correct 4 ms 640 KB Output is correct
12 Correct 3 ms 644 KB Output is correct
13 Correct 3 ms 652 KB Output is correct
14 Correct 3 ms 648 KB Output is correct
15 Correct 4 ms 640 KB Output is correct
16 Correct 3 ms 648 KB Output is correct
17 Correct 4 ms 652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 96 ms 2488 KB Output is correct
2 Correct 96 ms 2484 KB Output is correct
3 Correct 97 ms 2484 KB Output is correct
4 Correct 96 ms 2484 KB Output is correct
5 Correct 98 ms 2484 KB Output is correct
6 Correct 99 ms 2492 KB Output is correct
7 Correct 95 ms 2488 KB Output is correct
8 Correct 94 ms 2492 KB Output is correct
9 Correct 99 ms 2436 KB Output is correct
10 Correct 94 ms 2484 KB Output is correct
11 Correct 95 ms 2512 KB Output is correct
12 Correct 93 ms 2484 KB Output is correct
13 Correct 95 ms 2496 KB Output is correct
14 Correct 96 ms 2484 KB Output is correct
15 Correct 93 ms 2484 KB Output is correct
16 Correct 95 ms 2492 KB Output is correct
17 Correct 95 ms 2484 KB Output is correct
18 Correct 95 ms 2468 KB Output is correct
19 Correct 94 ms 2484 KB Output is correct