Submission #571860

# Submission time Handle Problem Language Result Execution time Memory
571860 2022-06-02T22:15:17 Z RandomLB Data Transfer (IOI19_transfer) C++17
100 / 100
108 ms 2612 KB
#include <bits/stdc++.h>
using namespace std;
 
std::vector<int> get_attachment(std::vector<int> v){
    int xr = 0;
    for (int i = 0; i < (int)v.size(); i++) xr ^= (i+1)*v[i];
    int on = 0;
  	std::vector<int> res;
    for (int i = 0; i < ((int)v.size()==63?6:8); i++){
        res.push_back(xr&1);
        if (xr&1) on = 1-on;
      	xr >>= 1;
    }
    res.push_back(on);
    return res;
}
 
std::vector<int> retrieve(std::vector<int> v){
    int n = ((int)v.size() < 100? 63 : 255);
    int xr = 0;
    std::vector<int> res;
    for (int i = 0; i < n; i++){
        xr ^= (i+1)*v[i];
        res.push_back(v[i]);
    }
    int check = 0, on = 0;
    for (int i = 0; i < (n==63?6:8); i++){
        if (v[n+i]){
            check ^= (1<<i);
            on ^= 1;
        }
    }
    if (xr != check && on == v.back()) res[(xr^check)-1] ^= 1;
    return res;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 640 KB Output is correct
2 Correct 3 ms 720 KB Output is correct
3 Correct 3 ms 640 KB Output is correct
4 Correct 3 ms 640 KB Output is correct
5 Correct 3 ms 648 KB Output is correct
6 Correct 4 ms 640 KB Output is correct
7 Correct 3 ms 640 KB Output is correct
8 Correct 3 ms 640 KB Output is correct
9 Correct 2 ms 648 KB Output is correct
10 Correct 3 ms 644 KB Output is correct
11 Correct 4 ms 648 KB Output is correct
12 Correct 3 ms 640 KB Output is correct
13 Correct 3 ms 648 KB Output is correct
14 Correct 3 ms 640 KB Output is correct
15 Correct 3 ms 648 KB Output is correct
16 Correct 3 ms 720 KB Output is correct
17 Correct 3 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 2404 KB Output is correct
2 Correct 95 ms 2488 KB Output is correct
3 Correct 97 ms 2484 KB Output is correct
4 Correct 98 ms 2496 KB Output is correct
5 Correct 94 ms 2492 KB Output is correct
6 Correct 101 ms 2492 KB Output is correct
7 Correct 94 ms 2492 KB Output is correct
8 Correct 94 ms 2612 KB Output is correct
9 Correct 95 ms 2480 KB Output is correct
10 Correct 96 ms 2488 KB Output is correct
11 Correct 96 ms 2492 KB Output is correct
12 Correct 95 ms 2484 KB Output is correct
13 Correct 97 ms 2484 KB Output is correct
14 Correct 95 ms 2492 KB Output is correct
15 Correct 97 ms 2472 KB Output is correct
16 Correct 97 ms 2492 KB Output is correct
17 Correct 96 ms 2496 KB Output is correct
18 Correct 98 ms 2484 KB Output is correct
19 Correct 108 ms 2484 KB Output is correct