Submission #1310916

#TimeUsernameProblemLanguageResultExecution timeMemory
1310916theiuliusData Transfer (IOI19_transfer)C++20
88 / 100
63 ms1728 KiB
#include "transfer.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define ll long long #define ff first #define ss second #define pb push_back using namespace std; std::vector<int> get_attachment(std::vector<int> a) { vector<int> v; int n = a.size(); for (int k = 7; k >= 0; k--){ int i = 0; int ans = 0; while (i < n){ for (int j = i; j < min(n, i + (1 << k)); j++){ ans ^= a[j]; } i += 2 * (1 << k); } v.pb(ans); } int ans = 0; for (int i = 0; i < n; i++){ ans ^= a[i]; } v.pb(ans); // for (auto h : v){ // cout << h; // } // cout << endl; return v; } std::vector<int> retrieve(std::vector<int> a) { int n = a.size() - 9; int K = 9; int ans0 = 0; for (int i = 0; i < n; i++){ // cout << a[i]; ans0 ^= a[i]; } // cout << endl; int l = 0, r = 255; for (int k = 7; k >= 0; k--){ int i = 0; int ans = 0; while (i < n){ for (int j = i; j < min(n, i + (1 << k)); j++){ ans ^= a[j]; } i += 2 * (1 << k); } if (a[n + (7 - k)] != ans){ // pirvel naxevarshia if (ans0 != a[n + K - 1]){ // n-shia corrupted r = (l + r) / 2; }else{ a.resize(n); return a; } }else{ // meore naxevarshia if (ans0 != a[n + K - 1]){ // n-shia corrupted l = (l + r + 1) / 2; } } } // cout << l << " " << r << endl; if (ans0 != a[n + K - 1]){ a[l] ^= 1; } a.resize(n); return a; }

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