# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
962785 |
2024-04-14T08:16:37 Z |
NValchanov |
Cave (IOI13_cave) |
C++17 |
|
301 ms |
604 KB |
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
typedef long long ll;
const ll MAXN = 100;
int door[MAXN];
int pos[MAXN];
ll n;
void flip_pos(ll to)
{
for(int i = 0; i <= to; i++)
{
if(door[i] == -1)
pos[i] ^= 1;
}
}
void init_switches()
{
for(int i = 0; i < n; i++)
{
door[i] = -1;
pos[i] = 0;
}
}
bool check(ll k, ll i)
{
flip_pos(k);
ll cur = tryCombination(pos);
flip_pos(k);
return cur == i;
}
void exploreCave(int N)
{
n = N;
init_switches();
for(int i = 0; i < n; i++)
{
ll cur = tryCombination(pos);
if(cur == i)
flip_pos(n - 1);
ll left = 0;
ll right = n - 1;
ll ans = -1;
ll mid;
while(left <= right)
{
mid = (left + right) / 2;
if(check(mid, i))
{
right = mid - 1;
ans = mid;
}
else
left = mid + 1;
}
door[ans] = i;
}
answer(pos, door);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
301 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 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 |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
1 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
440 KB |
Output is correct |
17 |
Correct |
0 ms |
344 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
344 KB |
Output is correct |
20 |
Incorrect |
65 ms |
456 KB |
Answer is wrong |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
301 ms |
592 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |