# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1104601 |
2024-10-24T06:38:21 Z |
Nonoze |
Machine (IOI24_machine) |
C++17 |
|
51 ms |
592 KB |
#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 time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
19 ms |
504 KB |
Output is correct |
3 |
Correct |
13 ms |
504 KB |
Output is correct |
4 |
Correct |
21 ms |
584 KB |
Output is correct |
5 |
Correct |
27 ms |
452 KB |
Output is correct |
6 |
Correct |
45 ms |
336 KB |
Output is correct |
7 |
Correct |
45 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
20 ms |
592 KB |
Output is correct |
3 |
Correct |
16 ms |
504 KB |
Output is correct |
4 |
Correct |
28 ms |
440 KB |
Output is correct |
5 |
Correct |
27 ms |
336 KB |
Output is correct |
6 |
Correct |
51 ms |
440 KB |
Output is correct |
7 |
Correct |
43 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
18 ms |
336 KB |
Output is correct |
3 |
Correct |
16 ms |
336 KB |
Output is correct |
4 |
Correct |
25 ms |
452 KB |
Output is correct |
5 |
Correct |
27 ms |
504 KB |
Output is correct |
6 |
Correct |
47 ms |
436 KB |
Output is correct |
7 |
Correct |
44 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
18 ms |
460 KB |
Output is correct |
3 |
Correct |
15 ms |
336 KB |
Output is correct |
4 |
Correct |
26 ms |
336 KB |
Output is correct |
5 |
Correct |
28 ms |
464 KB |
Output is correct |
6 |
Correct |
49 ms |
440 KB |
Output is correct |
7 |
Correct |
44 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
16 ms |
336 KB |
Output is correct |
3 |
Correct |
15 ms |
592 KB |
Output is correct |
4 |
Correct |
27 ms |
592 KB |
Output is correct |
5 |
Correct |
32 ms |
336 KB |
Output is correct |
6 |
Correct |
49 ms |
336 KB |
Output is correct |
7 |
Correct |
42 ms |
440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
20 ms |
336 KB |
Output is correct |
3 |
Correct |
15 ms |
336 KB |
Output is correct |
4 |
Correct |
26 ms |
592 KB |
Output is correct |
5 |
Correct |
29 ms |
468 KB |
Output is correct |
6 |
Correct |
46 ms |
336 KB |
Output is correct |
7 |
Correct |
49 ms |
432 KB |
Output is correct |