# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443430 | 2021-07-10T13:18:40 Z | chicken337 | Data Transfer (IOI19_transfer) | C++14 | 69 ms | 2540 KB |
#include <bits/stdc++.h> #include "transfer.h" using namespace std; vector<int> get_attachment(vector<int> source){ vector<int> ans; int xr = 0; for(int i = 0; i < source.size(); i ++) xr ^= source[i] * (i+1); int last = 0, rounds = source.size() < 64 ? 6 : 8; for(int i = 0; i < rounds; i ++){ ans.push_back(xr & 1); if(xr & 1) last ^= 1; xr >>= 1; } ans.push_back(last); return ans; } vector<int> retrieve(vector<int> data){ int last = data.back(); data.pop_back(); int actual = 0, xr = 0; int rounds = data.size() < 71 ? 6 : 8; for(int i = 0; i < rounds; i ++){ xr <<= 1; xr += data.back(); if(data.back()) last ^= 1; data.pop_back(); } if(actual != last) return vector<int>(data.begin(), data.end()); int x = 0; for(int i = 0; i < data.size(); i ++) x ^= data[i] * (i+1); int err = xr ^ x; if(err) data[err-1] ^= 1; return data; } /** int main(){ for(int i = 0; i < 100; i ++){ bool correct = true; vector<int> gen_seq; int len = rand() % 255 + 1; for(int i = 0; i < len; i ++) gen_seq.push_back(rand()&1); cout << "Generation OK" << endl; vector<int> attach = get_attachment(gen_seq); if(len < 64 && attach.size()>7) correct = 0; if(len > 63 && attach.size()>9) correct = 0; cout << "Attachment OK" << endl; vector<int> nans; for(int it : gen_seq) nans.push_back(it); for(int it : attach) nans.push_back(it); vector<int> res = retrieve(nans); cout << "Retrieval OK" << endl; if(res.size() != len) correct = 0, cout << "WRONG LENGTH" << endl; else for(int i = 0; i < res.size(); i ++) if(res[i] != gen_seq[i]) correct = 0, cout << "WRONG ELEMENT" << endl; cout << (correct ? "CORRECT" : "INCORRECT") << " with length " << len << endl; } }**/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 620 KB | Output is correct |
2 | Correct | 3 ms | 620 KB | Output is correct |
3 | Correct | 3 ms | 624 KB | Output is correct |
4 | Correct | 3 ms | 628 KB | Output is correct |
5 | Correct | 3 ms | 612 KB | Output is correct |
6 | Correct | 3 ms | 628 KB | Output is correct |
7 | Correct | 3 ms | 616 KB | Output is correct |
8 | Correct | 3 ms | 620 KB | Output is correct |
9 | Correct | 3 ms | 620 KB | Output is correct |
10 | Correct | 3 ms | 708 KB | Output is correct |
11 | Correct | 3 ms | 620 KB | Output is correct |
12 | Correct | 3 ms | 704 KB | Output is correct |
13 | Correct | 3 ms | 620 KB | Output is correct |
14 | Correct | 4 ms | 628 KB | Output is correct |
15 | Correct | 3 ms | 692 KB | Output is correct |
16 | Correct | 3 ms | 620 KB | Output is correct |
17 | Correct | 3 ms | 628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 44 ms | 2428 KB | Output is correct |
2 | Correct | 44 ms | 2428 KB | Output is correct |
3 | Correct | 46 ms | 2540 KB | Output is correct |
4 | Correct | 55 ms | 2464 KB | Output is correct |
5 | Correct | 47 ms | 2476 KB | Output is correct |
6 | Correct | 45 ms | 2468 KB | Output is correct |
7 | Correct | 44 ms | 2464 KB | Output is correct |
8 | Correct | 47 ms | 2464 KB | Output is correct |
9 | Correct | 46 ms | 2464 KB | Output is correct |
10 | Correct | 45 ms | 2464 KB | Output is correct |
11 | Correct | 46 ms | 2432 KB | Output is correct |
12 | Correct | 46 ms | 2464 KB | Output is correct |
13 | Correct | 44 ms | 2464 KB | Output is correct |
14 | Correct | 45 ms | 2460 KB | Output is correct |
15 | Correct | 45 ms | 2476 KB | Output is correct |
16 | Correct | 45 ms | 2476 KB | Output is correct |
17 | Correct | 52 ms | 2480 KB | Output is correct |
18 | Correct | 45 ms | 2464 KB | Output is correct |
19 | Correct | 69 ms | 2464 KB | Output is correct |