# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
467170 | 2021-08-21T20:13:11 Z | Urvuk3 | Data Transfer (IOI19_transfer) | C++17 | 12 ms | 5300 KB |
#include "transfer.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pll pair<ll,ll> #define pii pair<int,int> #define mid (l+r)/2 #define sz(a) int((a).size()) #define all(a) a.begin(),a.end() #define mod 1000000007LL #define pb push_back #define endl "\n" #define PRINT(x) cerr<<#x<<'-'<<x<<endl<<flush; #define getunique(v) {sort(all(v)); v.erase(unique(all(v)), v.end());} #define pb push_back #define pf push_front #define ppf pop_front #define ppb pop_back vector<int> to_bin(ll n,ll k){ vector<int> ret; while(n!=0){ ret.pb(n%2); n/=2; } for(int i=sz(ret);i<k;i++){ ret.pb(0); } return ret; } ll to_int(vector<int> bin){ ll ret=0; for(int i=0;i<sz(bin);i++){ ret+=bin[i]*(1<<i); } } vector<int> get_attachment(vector<int> source){ ll n=sz(source); ll k=(n==63 ? 6 : 8); ll x=0; ll odd=0; vector<int> append; for(int i=0;i<n;i++){ if(source[i]){ x^=i; } } append=to_bin(x,k); for(int i=0;i<k;i++){ if(append[i]){ odd^=1; } } append.pb(odd); source.insert(source.end(),all(append)); return source; } vector<int> retrieve(vector<int> data){ ll n=(sz(data)==70 ? 63 : 255); ll k=(n==63 ? 6 : 8); ll x=0; ll pravix=0; ll odd=data.back(); vector<int> bitsn(data.begin(),data.begin()+n),bitsk(data.begin()+n,data.end()-1); pravix=to_int(bitsk); for(int i=0;i<n;i++){ if(bitsn[i]){ x^=i; } } if(x==pravix){ return bitsn; } else{ if((count(all(bitsk),1)&1)==odd){ int idx=pravix^x; bitsn[idx]=1; } else{ return bitsn; } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1264 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 5300 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |