Submission #1006282

#TimeUsernameProblemLanguageResultExecution timeMemory
1006282AlmontherData Transfer (IOI19_transfer)C++17
40 / 100
78 ms2516 KiB
#include <bits/stdc++.h> #include "transfer.h" #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff vector<int>get_attachment(vector<int>source){ vector<int>arr; ll n=source.size(); ll num=0; ll pa=0; for(int i=0;i<n;i++){ if(source[i]) num^=i+1; pa^=source[i]; } string s=""; while(num){ s+='0'+(num%2); num>>=1; } reverse(s.begin(),s.end()); while(s.size()<((n==255)?8:6)) s='0'+s; for(auto i:s) arr.push_back(i-'0'); arr.push_back(pa); return arr; } vector<int>retrieve(vector<int>data){ vector<int>arr=data; ll n=arr.size(); ll pa,pa1,num; pa=0,pa1=0,num=0; ll test=arr[n-1]; ll n1=((n>=255)?255:63); vector<int>ans; for(int i=n1;i<n1+((n1==255)?8:6);i++){ num=num*2+arr[i]; } for(int i=0;i<n1;i++){ pa^=arr[i]; if(arr[i]) num^=i+1; } pa1=pa; if(num){ if(arr[num-1]) pa1=((pa1-1)%2+2)%2; else pa1=(pa1+1)%2; if(pa1==test){ for(int i=0;i<n1;i++){ ans.push_back(arr[i]); } ans[num-1]^=1; return ans; } else{ for(int i=0;i<n1;i++){ ans.push_back(arr[i]); } return ans; } } else{ for(int i=0;i<255;i++){ ans.push_back(arr[i]); } return ans; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...