#include "xylophone.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 5010;
int n;
int v[MAXN];
int ans[MAXN];
int diff[MAXN][2], t[MAXN];
int signal(int s)
{
if( s > 0 ) return 1;
return -1;
}
void test()
{
for(int i = 1 ; i <= n ; i++)
t[i] = diff[i][0];
for(int i = 2 ; i < n ; i++)
{
t[i] = abs( t[i] );
if( diff[i - 1][0] + diff[i][0] == diff[i - 1][1] ) t[i] *= signal( t[i - 1] );
else t[i] *= signal( -t[i - 1] );
}
for(int i = 2 ; i <= n ; i++)
ans[i] = ans[i - 1] + t[i - 1];
int mn = ans[1];
for(int i = 1 ; i <= n ; i++)
mn = min( mn , ans[i] );
for(int i = 1 ; i <= n ; i++)
ans[i] += -mn + 1;
int prefixMn = n + 1;
for(int i = 1 ; i <= n ; i++)
{
if( ans[i] == n && prefixMn != 1 ) return;
prefixMn = min( prefixMn , ans[i] );
}
for(int i = 1 ; i <= n ; i++)
answer( i , ans[i] );
exit(0);
}
void solve(int N)
{
n = N;
for(int i = 1 ; i + 1 <= N ; i++)
diff[i][0] = query( i , i + 1 );
for(int i = 1 ; i + 2 <= N ; i++)
diff[i][1] = query( i , i + 2 );
test();
diff[1][0] = -diff[1][0];
test();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |