Submission #529001

#TimeUsernameProblemLanguageResultExecution timeMemory
529001tabrData Transfer (IOI19_transfer)C++17
0 / 100
3 ms1004 KiB
#ifndef tabr #include "transfer.h" #endif #include <bits/stdc++.h> using namespace std; #ifdef tabr #include "library/debug.cpp" #else #define debug(...) #endif vector<int> get_attachment(vector<int> a) { int n = (int) a.size(); vector<int> b; for (int i = 0; i < n; i++) { for (int j = 0; j < 3; j++) { b.emplace_back(a[i]); } } return b; } vector<int> retrieve(vector<int> a) { int n = (int) a.size(); vector<int> b; for (int i = 0; i < n; i += 3) { b.emplace_back(0); for (int j = 0; j < 3; j++) { b.back() += a[j]; } b.back() /= 2; } return b; } #ifdef tabr mt19937 rng((unsigned int) chrono::steady_clock::now().time_since_epoch().count()); int rand_int(int a, int b) { // [a, b] return uniform_int_distribution<int>(a, b)(rng); } int main() { ios::sync_with_stdio(false); cin.tie(0); int n = 7; int tt = 1000; while (tt--) { vector<int> a(n); for (int i = 0; i < n; i++) { a[i] = rand_int(0, 1); } auto b = get_attachment(a); int pos = rand_int(-1, (int) b.size() - 1); if (pos >= 0) { b[pos] ^= 1; } auto c = retrieve(b); if (a == c) { // cerr << "OK" << endl; } else { cerr << "NG" << endl; debug(pos); debug(a); debug(b); debug(c); } } return 0; } #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...