Submission #1287634

#TimeUsernameProblemLanguageResultExecution timeMemory
1287634VMaksimoski008Data Transfer (IOI19_transfer)C++20
100 / 100
155 ms1732 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; vector<int> get_attachment(vector<int> S) { int n = S.size(); vector<int> ans; int k = (n == 63 ? 6 : 8); int X = 0; for(int i=0; i<n; i++) if(S[i]) X ^= (i+1); int cnt = 0; for(int i=0; i<k; i++) { if(X & (1 << i)) ans.push_back(1), cnt++; else ans.push_back(0); } ans.push_back(cnt & 1); return ans; } vector<int> retrieve(vector<int> D) { vector<int> ans; int n = (D.size() == 70 ? 63 : 255); int k = (n == 63 ? 6 : 8); int X = 0; for(int i=n; i<n+k; i++) if(D[i]) X += (1 << (i-n)); if(__builtin_parity(X) != D.back()) { for(int i=0; i<n; i++) ans.push_back(D[i]); return ans; } int Y = 0; for(int i=0; i<n; i++) if(D[i]) Y ^= (i+1); for(int i=0; i<n; i++) { if((Y ^ (i+1)) == X) { D[i] ^= 1; break; } } for(int i=0; i<n; i++) ans.push_back(D[i]); return ans; }

Compilation message (stderr)

grader.cpp: In instantiation of 'void shuffle(std::vector<T>&) [with T = Scenario]':
grader.cpp:200:10:   required from here
grader.cpp:28:23: warning: 'void std::random_shuffle(_RAIter, _RAIter) [with _RAIter = __gnu_cxx::__normal_iterator<Scenario*, vector<Scenario> >]' is deprecated: use 'std::shuffle' instead [-Wdeprecated-declarations]
   28 |         random_shuffle(v.begin(), v.end());
      |         ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/13/algorithm:61,
                 from grader.cpp:8:
/usr/include/c++/13/bits/stl_algo.h:4581:5: note: declared here
 4581 |     random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
      |     ^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...