#include <bits/stdc++.h>
#include "xylophone.h"
using namespace std;
#define sz(x) (int)x.size()
#define fi first
#define se second
typedef long long lli;
typedef pair<int, int> pii;
const int maxn = 5005;
int n;
int a[maxn];
void solve(int N)
{
n = N;
int r = n - 1;
while(query(1, r) == n - 1)
--r;
++r; a[r] = n;
int l = 2;
while(query(2, l) == n - 1)
++l;
--l; a[l] = 1;
for(int i = 1; i < l; ++i)
a[i] = query(i, l) + 1;
for(int i = l + 1; i < r; ++i)
a[i] = n - query(i, r);
for(int i = r + 1; i <= n; ++i)
a[i] = n - query(r, i);
for(int i = 1; i <= n; ++i)
answer(i, a[i]);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Wrong Answer [7] |
4 |
Halted |
0 ms |
0 KB |
- |