# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
306290 |
2020-09-25T05:15:03 Z |
talant117408 |
Cave (IOI13_cave) |
C++17 |
|
163 ms |
536 KB |
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
const int N = 5003;
vector <int> used(N);
/*
bool tryCombination(vector <int> pos){
return true;
}
void answer(vector <int> pos, vector <int> door){
for(auto to : pos) cout << to << ' ';
cout << endl;
for(auto to : door) cout << to << ' ';
}*/
bool check(int pos[], int truepos, int l, int r){
for(int i = l; i <= r; i++){
if(used[i]) continue;
pos[i] = truepos;
}
return tryCombination(pos);
}
/*
void exploreCave(int n);
int main() {
int N;
cin >> N;
exploreCave(N);
printf("INCORRECT\nYour solution did not call answer().\n");
return 0;
}*/
void exploreCave(int n){
int pos0[n], pos1[n], doornum[n];
for(int i = 0; i < n; i++) pos1[i] = 1;
for(int door = 0; door < n; door++){
int truepos = 1;
int closed = tryCombination(pos0);
if(closed == -1 || closed > door) truepos--;
int l = 0, r = n-1;
while(l < r){
int mid = (l+r)>>1;
if(check((truepos ? pos0 : pos1), truepos, l, mid)){
r = mid;
}
else{
l = mid+1;
}
}
used[l]++;
doornum[l] = door;
pos0[l] = pos1[l] = truepos;
}
answer(pos0, doornum);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
163 ms |
536 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
384 KB |
Answer is wrong |
2 |
Halted |
0 ms |
0 KB |
- |