# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
915225 |
2024-01-23T14:20:59 Z |
LCJLY |
Cave (IOI13_cave) |
C++14 |
|
180 ms |
600 KB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n) {
//determine first switch
int arr[n];
memset(arr,0,sizeof(arr));
int visited[n];
memset(visited,0,sizeof(visited));
int ans[n];
for(int x=0;x<n;x++){
for(int y=0;y<n;y++){
if(!visited[y]) arr[y]=0;
}
int hold=tryCombination(arr);
if(hold==-1) hold=n;
bool amos=false;
if(hold<=x) amos=true;
int l=0;
int r=n-1;
int best=l;
int mid;
while(l<=r){
mid=(l+r)/2;
for(int y=0;y<n;y++){
if(y<=mid&&!visited[y]){
arr[y]=!amos;
}
else if(!visited[y]) arr[y]=amos;
}
int hold2=tryCombination(arr);
if(hold2==-1) hold2=n;
if(hold2<=x){
best=mid;
r=mid-1;
}
else l=mid+1;
}
visited[best]=true;
arr[best]=!amos;
ans[x]=best;
}
answer(arr,ans);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
124 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
180 ms |
600 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
124 ms |
348 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |