Submission #1316537

#TimeUsernameProblemLanguageResultExecution timeMemory
1316537aaaaaaaaData Transfer (IOI19_transfer)C++20
0 / 100
4 ms1712 KiB
#include "transfer.h" #include <bits/stdc++.h> using namespace std; int K = 10; std::vector<int> get_attachment(std::vector<int> source) { vector<int> ans(K, 0); int x = 0, cnt2 = 0; for(int i = 0; i < (int) source.size(); ++i){ x ^= source[i] * i; if(source[i]) cnt2 += 1; } int cnt = 0; for(int i = K - 3; i >= 0; --i){ if(x & (1 << i)){ ans[i] = 1; cnt += 1; } } ans[K - 2] = (cnt2 % 2); ans[K - 1] = (cnt % 2); return ans; } std::vector<int> retrieve(std::vector<int> data) { int n = data.size(), cnt = 0, x = 0; for(int j = n - 3, ptr = K - 3; ptr >= 0; --j, --ptr){ if(data[j]) { cnt += 1; x |= (1 << ptr); } } vector<int> ans; for(int j = 0; j < n - K; ++j){ ans.push_back(data[j]); } if((cnt & 1) == data.back()){ int nx = 0, setbit = 0; for(int j = 0; j < n - K; ++j){ if(data[j]) nx ^= data[j] * j, setbit += 1; } if((setbit & 1) == data[n - 2]){ return ans; } for(int j = 0; j < n - K; ++j){ if(data[j]){ if((nx ^ (data[j] * j)) == x){ ans[j] ^= 1; break; } } else{ if((nx ^ ((!data[j]) * j)) == x){ ans[j] ^= 1; break; } } } } 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...