#define wiwihorz
#include "grader.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma loop-opt(on)
#define rep(i, a, b) for(int i = a; i <= b; i ++)
#define rrep(i, a, b) for(int i = b; i >= a; i--)
#define all(x) x.begin(), x.end()
#define ceil(a, b) ((a + b - 1) / (b))
using namespace std;
#define lld long double
#define pii pair<int, int>
#define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count())
#ifdef wiwihorz
#define print(a...) cerr << "Line: " << __LINE__, kout("[" + string(#a) + "] = ", a)
void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
void kout() { cerr << endl; }
template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...);}
#else
#define print(...) 0
#define vprint(...) 0
#endif
//int n, tot;
//vector<int> a;
void init_(int _n) {
// n = _n, tot = 0;
// a.assign(n + 1, 0);
// rep(i, 1, n) a[i] = i;
// shuffle(a.begin() + 1, a.begin() + n + 1, rnd);
}
/*
int query(vector<int> b) {
assert(b.size() == n + 1);
int cnt = 0;
tot ++;
rep(i, 1, n) cnt += a[i] == b[i];
return cnt;
}
*/
void solve(int n) {
// init_(n);
vector<int> v(n, 0);
rep(i, 1, n) v[i - 1] = i;
int cur = query(v), tp;
if(cur == n) return;
rep(i, 0, n - 1) {
rep(j, i + 1, n - 1) {
swap(v[i], v[j]);
if(tp = query(v), tp >= cur) cur = tp;
else swap(v[i], v[j]);
if(cur == n) return;
}
}
assert(0);
return;
// assert(cur == n);
}
/*signed main() {
ios::sync_with_stdio(false), cin.tie(0);
int t; cin >> t;
while(t--) {
int n; cin >> n;
solve(n);
print(tot);
}
return 0;
}*/
Compilation message
mouse.cpp:5: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
5 | #pragma loop-opt(on)
|
mouse.cpp:20:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
mouse.cpp:20:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
20 | void vprint(auto L, auto R) { cerr << *L << " \n"[next(L) == R], ++L; }
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 12 |
2 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 6 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 19 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 22 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 12 |
2 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 6 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 19 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 22 |
7 |
Correct |
18 ms |
200 KB |
Correct! Number of queries: 1300 |
8 |
Correct |
19 ms |
200 KB |
Correct! Number of queries: 1200 |
9 |
Correct |
18 ms |
200 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1300 |
11 |
Correct |
11 ms |
200 KB |
Correct! Number of queries: 900 |
12 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1200 |
13 |
Correct |
15 ms |
200 KB |
Correct! Number of queries: 1100 |
14 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1200 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 12 |
2 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 6 |
3 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
4 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 19 |
5 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 16 |
6 |
Correct |
1 ms |
200 KB |
Correct! Number of queries: 22 |
7 |
Correct |
18 ms |
200 KB |
Correct! Number of queries: 1300 |
8 |
Correct |
19 ms |
200 KB |
Correct! Number of queries: 1200 |
9 |
Correct |
18 ms |
200 KB |
Correct! Number of queries: 1100 |
10 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1300 |
11 |
Correct |
11 ms |
200 KB |
Correct! Number of queries: 900 |
12 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1200 |
13 |
Correct |
15 ms |
200 KB |
Correct! Number of queries: 1100 |
14 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1200 |
15 |
Correct |
21 ms |
200 KB |
Correct! Number of queries: 1200 |
16 |
Correct |
16 ms |
200 KB |
Correct! Number of queries: 1200 |
17 |
Runtime error |
188 ms |
200 KB |
Execution killed with signal 13 |
18 |
Halted |
0 ms |
0 KB |
- |