Submission #1322205

#TimeUsernameProblemLanguageResultExecution timeMemory
1322205nathan4690Data Transfer (IOI19_transfer)C++20
100 / 100
60 ms1712 KiB
#include "transfer.h" std::vector<int> get_attachment(std::vector<int> source) { int ad = source.size() == 63 ? 6 : 8; int xx = 0; for(int i = 0; i < source.size(); i++){ if(source[i]) xx ^= i + 1; } std::vector<int> res; int pr = 0; for(int i = 0; i < ad; i++){ res.push_back(xx >> i & 1); pr ^= xx >> i & 1; } res.push_back(pr); return res; } std::vector<int> retrieve(std::vector<int> data) { int n = data.size() < 100 ? 63 : 255; std::vector<int> orig; int cx = 0; for(int i = 0; i < n; i++){ orig.push_back(data[i]); if(data[i]) cx ^= i + 1; } int xx = 0, pr = 0; for(int i = n; i + 1 < data.size(); i++){ xx += (data[i]) << (i - n); pr ^= data[i]; } if(pr == data.back()){ if(xx != cx){ int pos = xx ^ cx; orig[pos - 1] ^= 1; } } return orig; }

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...