| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1369425 | eyadooz | Data Transfer (IOI19_transfer) | C++20 | 40 ms | 1724 KiB |
#include<bits/stdc++.h>
// #include"transfer.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
vector<int> get_attachment(vector<int> source){
vector<int> s;
int x=0, y=0;
for(int i = 0;i < sz(source);i++) x^=(source[i]?i+1:0), y^=source[i];
if(sz(source)<=63) for(int j=0;j<6;j++) s.pb((x>>j)&1);
else if(sz(source)<=255) for(int j=0;j<8;j++) s.pb((x>>j)&1);
s.pb(y);
return s;
}
vector<int> retrieve(vector<int> data) {
int n=sz(data)-7, x=0, xo=0, sp=0;
if(sz(data)>=63+8) n=sz(data)-9;
for(int i = 0;i < n;i++) x^=data[i], xo^=(data[i]?i+1:0);
for(int i=n;i<sz(data)-1;i++) if(data[i]==1) sp|=(1ll<<(i-n));
int f=data.back(), y=xo^sp;
vector<int> ans;
for(int i = 0;i < n;i++) ans.pb(data[i]);
if(xo==sp) return ans;
if(x!=f) ans[y-1]^=1;
return ans;
}
Compilation message (stderr)
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
