Submission #1172018

#TimeUsernameProblemLanguageResultExecution timeMemory
1172018fryingducMachine (IOI24_machine)C++20
10 / 100
4 ms440 KiB
#include "machine.h" #include "bits/stdc++.h" using namespace std; #ifdef duc_debug #include "bits/debug.h" #else #define debug(...) #endif vector<int> find_permutation(int N) { int n = N; if (n & 1) { vector<int> a(n); iota(a.begin(), a.end(), 0); vector<int> b = use_machine(a); int x = 0; for (int i = 0; i < n; ++i) { bool flag = 0; for (int j = 0; j < n; ++j) { if (i == j) continue; if ((b[i] ^ b[j]) == 1) { flag = 1; break; } } if (!flag) { x = b[i] ^ (n - 1); break; } } vector<int> rev(n); for (int i = 0; i < n; ++i) { b[i] ^= x; } return b; } else { vector<int> a(n); iota(a.begin(), a.end(), 1); a[n - 1] = n + 2; vector<int> b = use_machine(a); for (int x = 0; x < 256; ++x) { vector<int> c(n + 1); bool flag = 1; for (int i = 0; i < n; ++i) { int t = b[i] ^ x; if (t > n + 2) { flag = 0; break; } else if (t == n + 2) { if (c[n]) { flag = 0; break; } c[n] = 1; } else { if (c[t]) { flag = 0; break; } c[t] = 1; } } if (flag) { for (auto &i : b) { i ^= x; if (i == n + 2) i = n; --i; } return b; } } } }

Compilation message (stderr)

machine.cpp: In function 'std::vector<int> find_permutation(int)':
machine.cpp:76:1: warning: control reaches end of non-void function [-Wreturn-type]
   76 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...