#include <bits/stdc++.h>
#include "art.h"
#define fr(i, a, b) for (int i = a; i <= b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define fe(x, y) for (auto& x : y)
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pw(x) (1LL << (x))
using namespace std;
template <typename T>
using ve = vector < T >;
template <typename T>
bool umx(T& a, T b) {return a < b ? a = b, 1 : 0;}
template <typename T>
bool umn(T& a, T b) {return a > b ? a = b, 1 : 0;}
using ll = long long;
using pll = pair <ll, ll>;
using pii = pair <int, int>;
const int N = 2e5 + 100;
const int oo = 1e9 + 10;
const ll OO = 1e18 + 100;
void solve(int n) {
vector<int> order(n);
iota(all(order), 1);
int val = publish(order);
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
swap(order[i], order[j]);
int x = publish(order);
if (val > x) {
val = x;
} else swap(order[i], order[j]);
}
}
answer(order);
}
Compilation message
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
11 ms |
296 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
11 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
1 ms |
208 KB |
Output is correct |
19 |
Correct |
8 ms |
208 KB |
Output is correct |
20 |
Correct |
10 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
11 ms |
296 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
11 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
1 ms |
208 KB |
Output is correct |
19 |
Correct |
8 ms |
208 KB |
Output is correct |
20 |
Correct |
10 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
10 ms |
208 KB |
Output is correct |
23 |
Correct |
8 ms |
208 KB |
Output is correct |
24 |
Correct |
10 ms |
208 KB |
Output is correct |
25 |
Correct |
10 ms |
208 KB |
Output is correct |
26 |
Incorrect |
117 ms |
208 KB |
Not correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
11 ms |
296 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
11 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
1 ms |
208 KB |
Output is correct |
19 |
Correct |
8 ms |
208 KB |
Output is correct |
20 |
Correct |
10 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
10 ms |
208 KB |
Output is correct |
23 |
Correct |
8 ms |
208 KB |
Output is correct |
24 |
Correct |
10 ms |
208 KB |
Output is correct |
25 |
Correct |
10 ms |
208 KB |
Output is correct |
26 |
Incorrect |
117 ms |
208 KB |
Not correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
11 ms |
296 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
11 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
1 ms |
208 KB |
Output is correct |
19 |
Correct |
8 ms |
208 KB |
Output is correct |
20 |
Correct |
10 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
10 ms |
208 KB |
Output is correct |
23 |
Correct |
8 ms |
208 KB |
Output is correct |
24 |
Correct |
10 ms |
208 KB |
Output is correct |
25 |
Correct |
10 ms |
208 KB |
Output is correct |
26 |
Incorrect |
117 ms |
208 KB |
Not correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Correct |
0 ms |
208 KB |
Output is correct |
4 |
Correct |
1 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
0 ms |
208 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
11 ms |
296 KB |
Output is correct |
10 |
Correct |
8 ms |
208 KB |
Output is correct |
11 |
Correct |
9 ms |
208 KB |
Output is correct |
12 |
Correct |
11 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
1 ms |
208 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
1 ms |
208 KB |
Output is correct |
19 |
Correct |
8 ms |
208 KB |
Output is correct |
20 |
Correct |
10 ms |
208 KB |
Output is correct |
21 |
Correct |
0 ms |
208 KB |
Output is correct |
22 |
Correct |
10 ms |
208 KB |
Output is correct |
23 |
Correct |
8 ms |
208 KB |
Output is correct |
24 |
Correct |
10 ms |
208 KB |
Output is correct |
25 |
Correct |
10 ms |
208 KB |
Output is correct |
26 |
Incorrect |
117 ms |
208 KB |
Not correct |
27 |
Halted |
0 ms |
0 KB |
- |