#include<bits/stdc++.h>
#include "xylophone.h"
using namespace std;
static int A[5000];
void solve(int N) {
int l=1,r=N,mid,i,mx=1,idx=0;
while(r>l){
mid=(r+l+1)/2;
if(query(mid,N)==N-1) l=mid;
else r=mid-1;
}
cout << l << "\n";
answer(l,1);
for(i=l+1;i<=N;i++){
int x=query(l,i),y;
if(x>=mx){
answer(i,x+1);
mx=x+1;
idx=i;
}
else{
y=query(idx,i);
answer(i,mx-y);
}
}
}
Compilation message
xylophone.cpp:4:12: warning: 'A' defined but not used [-Wunused-variable]
4 | static int A[5000];
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |