# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745710 | 2023-05-21T03:28:19 Z | Pacybwoah | Data Transfer (IOI19_transfer) | C++14 | 62 ms | 2496 KB |
#include "transfer.h" #include<iostream> #include<vector> using namespace std; vector<int> get_attachment(vector<int> source) { int n=source.size(); int k; if(n==63){ k=7; int xorsum=0; for(int i=1;i<=n;i++) if(source[i-1]) xorsum^=i; vector<int> vec; int cnt=0; for(int i=32;i>0;i>>=1){ if(xorsum&i) vec.push_back(1),cnt++; else vec.push_back(0); } if(cnt&1) vec.push_back(1); else vec.push_back(0); return vec; } else{ k=9; int xorsum=0; for(int i=1;i<=n;i++) if(source[i-1]) xorsum^=i; vector<int> vec; int cnt=0; for(int i=128;i>0;i>>=1){ if(xorsum&i) vec.push_back(1),cnt++; else vec.push_back(0); } if(cnt&1) vec.push_back(1); else vec.push_back(0); return vec; } } vector<int> retrieve(vector<int> data) { int n=data.size(); if(n==70){ int xorsum=0; for(int i=1;i<=63;i++) if(data[i-1]) xorsum^=i; int xordata=0,cnt=0; for(int i=63;i<69;i++){ xordata<<=1; if(data[i]){ xordata++; cnt++; } } if((cnt&1)!=data[69]||xorsum==xordata){ vector<int> vec(63); for(int i=0;i<63;i++) vec[i]=data[i]; return vec; } else{ xorsum^=xordata; data[xorsum-1]=1-data[xorsum-1]; vector<int> vec(63); for(int i=0;i<63;i++) vec[i]=data[i]; return vec; } } else{ int xorsum=0; for(int i=1;i<=255;i++) if(data[i-1]) xorsum^=i; int xordata=0,cnt=0; for(int i=255;i<263;i++){ xordata<<=1; if(data[i]){ xordata++; cnt++; } } if((cnt&1)!=data[263]||xorsum==xordata){ vector<int> vec(255); for(int i=0;i<255;i++) vec[i]=data[i]; return vec; } else{ xorsum^=xordata; data[xorsum-1]=1-data[xorsum-1]; vector<int> vec(255); for(int i=0;i<255;i++) vec[i]=data[i]; return vec; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 640 KB | Output is correct |
2 | Correct | 3 ms | 652 KB | Output is correct |
3 | Correct | 3 ms | 652 KB | Output is correct |
4 | Correct | 3 ms | 644 KB | Output is correct |
5 | Correct | 3 ms | 644 KB | Output is correct |
6 | Correct | 3 ms | 648 KB | Output is correct |
7 | Correct | 3 ms | 644 KB | Output is correct |
8 | Correct | 3 ms | 728 KB | Output is correct |
9 | Correct | 2 ms | 644 KB | Output is correct |
10 | Correct | 3 ms | 644 KB | Output is correct |
11 | Correct | 3 ms | 736 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 | 644 KB | Output is correct |
15 | Correct | 3 ms | 648 KB | Output is correct |
16 | Correct | 3 ms | 644 KB | Output is correct |
17 | Correct | 3 ms | 652 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 47 ms | 2484 KB | Output is correct |
2 | Correct | 47 ms | 2488 KB | Output is correct |
3 | Correct | 48 ms | 2484 KB | Output is correct |
4 | Correct | 58 ms | 2456 KB | Output is correct |
5 | Correct | 62 ms | 2488 KB | Output is correct |
6 | Correct | 60 ms | 2488 KB | Output is correct |
7 | Correct | 59 ms | 2488 KB | Output is correct |
8 | Correct | 52 ms | 2496 KB | Output is correct |
9 | Correct | 41 ms | 2444 KB | Output is correct |
10 | Correct | 40 ms | 2488 KB | Output is correct |
11 | Correct | 40 ms | 2404 KB | Output is correct |
12 | Correct | 50 ms | 2496 KB | Output is correct |
13 | Correct | 53 ms | 2488 KB | Output is correct |
14 | Correct | 46 ms | 2488 KB | Output is correct |
15 | Correct | 47 ms | 2492 KB | Output is correct |
16 | Correct | 54 ms | 2496 KB | Output is correct |
17 | Correct | 53 ms | 2492 KB | Output is correct |
18 | Correct | 52 ms | 2488 KB | Output is correct |
19 | Correct | 48 ms | 2496 KB | Output is correct |