#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< int, int > ii;
typedef pair< int, ii > iii;
typedef vector< int > vi;
typedef vector< ii > vii;
typedef vector< iii > viii;
typedef vector< vi > vvi;
typedef vector< vii > vvii;
typedef vector< viii > vviii;
#define hdp 1e9+7
#define MAX LLONG_MAX
#define st first
#define nd second
const int N = 5005;
int a[N];
void solve(int n){
a[2] = query(1, 2);
for(int i=3; i<=n; i++){
int x = query(i-1, i);
int y = query(i-2, i);
if((x != y + abs(a[i-1] - a[i-2]) and a[i-2] > a[i-1]) or (x == y + abs(a[i-1] - a[i-2]) and a[i-1] > a[i-2]))
a[i] = a[i-1] + x;
else
a[i] = a[i-1] - x;
}
if(min_element(a+1, a+n+1) > max_element(a+1, a+n+1))
for(int i=1; i<=n; i++) a[i] *= -1;
int m = *min_element(a+1, a+n+1);
for(int i=1; i<=n; i++) answer(i, a[i]-m+1);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [4] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [4] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
1 ms |
208 KB |
Output is correct |
3 |
Incorrect |
1 ms |
208 KB |
Wrong Answer [4] |
4 |
Halted |
0 ms |
0 KB |
- |