# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1007837 |
2024-06-25T14:24:58 Z |
Newtonabc |
Cave (IOI13_cave) |
C++14 |
|
186 ms |
536 KB |
#include "cave.h"
#include<bits/stdc++.h>
using namespace std;
/*int tryCombination(int arr[]){
int ttmp=4;
for(int i=0;i<ttmp;i++) cout<<arr[i] <<" ";
cout<<"\n";
int s;
cin>>s;
return s;
}*/
void exploreCave(int N) {
bool one;
int arr[N],fix[N],cn[N];
for(int i=0;i<N;i++) arr[i]=fix[i]=cn[i]=0;
for(int i=0;i<N;i++){
int l=0,r=N-1;
for(int j=0;j<N;j++) if(!fix[j]) arr[j]=1;
int tmp=tryCombination(arr);
if(tmp==-1) tmp=INT_MAX;
if(tmp>i) one=true;
else one=false;
while(l<r){
int mid=(l+r)/2;
if(one){
for(int j=l;j<=mid;j++) if(!fix[j]) arr[j]=1;
for(int j=mid+1;j<=r;j++) if(!fix[j]) arr[j]=0;
tmp=tryCombination(arr);
if(tmp==-1) tmp=INT_MAX;
if(tmp>i){
r=mid;
if(l==r) arr[l]=1,cn[l]=i,fix[l]=1;
continue;
}
else{
l=mid+1;
if(l==r) arr[l]=1,cn[l]=i,fix[l]=1;
continue;
}
}
else{
for(int j=l;j<=mid;j++) if(!fix[j]) arr[j]=0;
for(int j=mid+1;j<=r;j++) if(!fix[j]) arr[j]=1;
tmp=tryCombination(arr);
if(tmp==-1) tmp=INT_MAX;
if(tmp>i){
r=mid;
if(l==r) arr[l]=0,cn[l]=i,fix[l]=1;
continue;
}
else{
l=mid+1;
if(l==r) arr[l]=0,cn[l]=i,fix[l]=1;
continue;
}
}
}
}
if(N==1){
if(one) arr[0]=1;
answer(arr,cn);
return;
}
/*cout<<endl <<endl <<endl;
for(int i=0;i<N;i++) cout<<arr[i] <<" ";
for(int i=0;i<N;i++) cout<<cn[i] <<" ";*/
answer(arr,cn);
}
/*int main(){
exploreCave(4);
}*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
344 KB |
Output is correct |
2 |
Correct |
86 ms |
344 KB |
Output is correct |
3 |
Correct |
145 ms |
344 KB |
Output is correct |
4 |
Correct |
95 ms |
508 KB |
Output is correct |
5 |
Correct |
129 ms |
344 KB |
Output is correct |
6 |
Correct |
134 ms |
344 KB |
Output is correct |
7 |
Correct |
137 ms |
532 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
Answer is wrong |
9 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
136 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
143 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
138 ms |
536 KB |
Output is correct |
7 |
Correct |
186 ms |
344 KB |
Output is correct |
8 |
Correct |
163 ms |
348 KB |
Output is correct |
9 |
Correct |
162 ms |
348 KB |
Output is correct |
10 |
Correct |
172 ms |
348 KB |
Output is correct |
11 |
Correct |
169 ms |
520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
20 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
0 ms |
348 KB |
Output is correct |
23 |
Correct |
24 ms |
488 KB |
Output is correct |
24 |
Correct |
25 ms |
344 KB |
Output is correct |
25 |
Correct |
25 ms |
348 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
20 ms |
348 KB |
Output is correct |
29 |
Correct |
1 ms |
348 KB |
Output is correct |
30 |
Correct |
24 ms |
348 KB |
Output is correct |
31 |
Correct |
20 ms |
484 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
25 ms |
348 KB |
Output is correct |
36 |
Correct |
24 ms |
488 KB |
Output is correct |
37 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
90 ms |
344 KB |
Output is correct |
2 |
Correct |
86 ms |
344 KB |
Output is correct |
3 |
Correct |
145 ms |
344 KB |
Output is correct |
4 |
Correct |
95 ms |
508 KB |
Output is correct |
5 |
Correct |
129 ms |
344 KB |
Output is correct |
6 |
Correct |
134 ms |
344 KB |
Output is correct |
7 |
Correct |
137 ms |
532 KB |
Output is correct |
8 |
Incorrect |
0 ms |
344 KB |
Answer is wrong |
9 |
Halted |
0 ms |
0 KB |
- |