Submission #1061076

#TimeUsernameProblemLanguageResultExecution timeMemory
1061076vjudge1Data Transfer (IOI19_transfer)C++17
100 / 100
52 ms2520 KiB
#include "transfer.h" using namespace std; vector<int> get_attachment(vector<int> source) { vector<int>stuf; int n=source.size(),xorr=0,K=0; for(int i=0;i<n;i++) xorr^=source[i]*(i+1),K+=source[i]; vector<int>res; res.push_back(K&1); if(n<64)for(int i=6;i--;) res.push_back(xorr>>i&1); else for(int i=8;i--;) res.push_back(xorr>>i&1); return res; } std::vector<int> retrieve(std::vector<int> data) { int n=data.size()-7; if(data.size()>70)n-=2; vector<int>firstcup; int xorr=0,K=0; for(int i=0;i<n;i++) xorr^=data[i]*(i+1),K+=data[i], firstcup.push_back(data[i]); K&=1; int failodd=data[n]!=K; int xorgiv=0; for(int i=n+1;i<data.size();i++) xorgiv=xorgiv<<1|data[i]; if(failodd&&xorgiv^xorr) firstcup[(xorgiv^xorr)-1]^=1; return firstcup; }

Compilation message (stderr)

transfer.cpp: In function 'std::vector<int> retrieve(std::vector<int>)':
transfer.cpp:28:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=n+1;i<data.size();i++)
      |                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...