Submission #1104601

#TimeUsernameProblemLanguageResultExecution timeMemory
1104601NonozeMachine (IOI24_machine)C++17
100 / 100
51 ms592 KiB
#include "machine.h" #include <bits/stdc++.h> using namespace std; #define sz(x) (int)(x.size()) #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define pb push_back #define mp make_pair #define fi first #define se second #define cmin(a, b) a = min(a, b) #define cmax(a, b) a = max(a, b) bool works(vector<int> &a, vector<int> &b, int x) { vector<int> c; for (auto u: b) c.pb(x^u); sort(all(c)); return (a==c); } vector<bool> ok(256, 0); vector<int> find_permutation(int n) { vector<int> a(n), p(n); iota(all(a), 1); a.back()+=2; vector<int> b=use_machine(a); int xr=0; for (int x=0; x<256; x++) if (works(a, b, x)) { xr=x; break; } for (int i=0; i<n; i++) p[i]=xr^b[i]; for (auto &u: p) u--; p[max_element(all(p))-p.begin()]-=2; return p; }
#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...