#include <algorithm>
#include <iostream>
#include <fstream>
#include <cstring>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <deque>
#include <stack>
#include <list>
#include <set>
#include <map>
#include "cave.h"
using namespace std;
typedef long long ll;
#define MP make_pair
#define PB push_back
int s[5005],d[5005];
void get_d(int S[], int ss)
{
for(int i=0;i<ss;i++)
{
S[i]=(S[i]+1)%2;
int x=tryCombination(S);
d[i]=x;
S[i]=(S[i]+1)%2;
}
answer(S,d);
}
void exploreCave(int N)
{
int n = N, x = 0, y = 0;
int i=0;
while(i<=n-2)
{
x=tryCombination(s);
if(x==-1)
{
get_d(s,n);
return;
}
s[i+1]=(s[i+1]+1)%2;
y=tryCombination(s);
if(y==-1)
{
get_d(s,n);
return;
}
if(x==y)
s[i]=(s[i]+1)%2;
i++;
}
x=tryCombination(s);
if(x!=-1)
s[n-1]=(s[n-1]+1)%2;
get_d(s,n);
return;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
640 KB |
Output is correct |
2 |
Correct |
34 ms |
512 KB |
Output is correct |
3 |
Correct |
46 ms |
520 KB |
Output is correct |
4 |
Correct |
27 ms |
384 KB |
Output is correct |
5 |
Correct |
19 ms |
592 KB |
Output is correct |
6 |
Correct |
38 ms |
384 KB |
Output is correct |
7 |
Correct |
36 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
332 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
512 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
41 ms |
384 KB |
Output is correct |
13 |
Correct |
52 ms |
484 KB |
Output is correct |
14 |
Correct |
39 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
17 ms |
504 KB |
Output is correct |
2 |
Correct |
8 ms |
384 KB |
Output is correct |
3 |
Correct |
20 ms |
524 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
6 ms |
384 KB |
Output is correct |
6 |
Correct |
17 ms |
544 KB |
Output is correct |
7 |
Correct |
22 ms |
384 KB |
Output is correct |
8 |
Correct |
21 ms |
512 KB |
Output is correct |
9 |
Correct |
20 ms |
636 KB |
Output is correct |
10 |
Correct |
17 ms |
384 KB |
Output is correct |
11 |
Correct |
18 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
324 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
396 KB |
Output is correct |
5 |
Incorrect |
5 ms |
512 KB |
Answer is wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
512 KB |
Output is correct |
2 |
Correct |
5 ms |
324 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
4 |
Correct |
5 ms |
396 KB |
Output is correct |
5 |
Incorrect |
5 ms |
512 KB |
Answer is wrong |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
640 KB |
Output is correct |
2 |
Correct |
34 ms |
512 KB |
Output is correct |
3 |
Correct |
46 ms |
520 KB |
Output is correct |
4 |
Correct |
27 ms |
384 KB |
Output is correct |
5 |
Correct |
19 ms |
592 KB |
Output is correct |
6 |
Correct |
38 ms |
384 KB |
Output is correct |
7 |
Correct |
36 ms |
512 KB |
Output is correct |
8 |
Correct |
6 ms |
332 KB |
Output is correct |
9 |
Correct |
6 ms |
384 KB |
Output is correct |
10 |
Correct |
6 ms |
512 KB |
Output is correct |
11 |
Correct |
6 ms |
384 KB |
Output is correct |
12 |
Correct |
41 ms |
384 KB |
Output is correct |
13 |
Correct |
52 ms |
484 KB |
Output is correct |
14 |
Correct |
39 ms |
384 KB |
Output is correct |
15 |
Correct |
17 ms |
504 KB |
Output is correct |
16 |
Correct |
8 ms |
384 KB |
Output is correct |
17 |
Correct |
20 ms |
524 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
6 ms |
384 KB |
Output is correct |
20 |
Correct |
17 ms |
544 KB |
Output is correct |
21 |
Correct |
22 ms |
384 KB |
Output is correct |
22 |
Correct |
21 ms |
512 KB |
Output is correct |
23 |
Correct |
20 ms |
636 KB |
Output is correct |
24 |
Correct |
17 ms |
384 KB |
Output is correct |
25 |
Correct |
18 ms |
384 KB |
Output is correct |
26 |
Correct |
5 ms |
512 KB |
Output is correct |
27 |
Correct |
5 ms |
324 KB |
Output is correct |
28 |
Correct |
6 ms |
512 KB |
Output is correct |
29 |
Correct |
5 ms |
396 KB |
Output is correct |
30 |
Incorrect |
5 ms |
512 KB |
Answer is wrong |
31 |
Halted |
0 ms |
0 KB |
- |