Submission #1310836

#TimeUsernameProblemLanguageResultExecution timeMemory
1310836nikoloz-chData Transfer (IOI19_transfer)C++20
0 / 100
8 ms3252 KiB
#include <bits/stdc++.h> #include "transfer.h" using namespace std; vector<int> get_attachment(vector<int> source){ int p = 0, k = 0; const int n = source.size(); const int kp = (n == 63 ? 6 : 8); for(int i = 0; i < n; ++i) if(source[i]) p ^= (i + 1); for(int b = 0; b < kp; ++b){ int bit = (p >> b) & 1; source.push_back(bit); k += bit; } source.push_back(k % 2); return source; } vector<int> retrieve(vector<int> data){ int p = 0, k = 0, kp = 0; const int n = data.size(); int knt = ((n - 7) == 63 ? 6 : 8); int pos = n - (knt + 1); for(int i = 0; i < pos; i++) if(data[i]) p ^= (i + 1); for(int b = 0; b < knt; b++){ int idx = pos + b; if(idx < 0 || idx >= n-1) return {}; if(data[idx]){ k |= (1 << b); ++kp; } } vector<int> ans; if(data.back() != (kp % 2)){ for(int i = 0; i < pos; ++i) ans.push_back(data[i]); return ans; } int cnt = p ^ k; for(int i = 0; i < pos; ++i){ if(cnt != 0 && i == (cnt - 1)) ans.push_back(data[i] ? 0 : 1); else ans.push_back(data[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...