# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
488112 |
2021-11-17T18:07:54 Z |
ssense |
Cave (IOI13_cave) |
C++14 |
|
1793 ms |
552 KB |
#include <bits/stdc++.h>
#include "cave.h"
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;
using namespace std;
#define vint vector<int>
#define all(v) v.begin(), v.end()
#define MOD 1000000007
#define MOD2 998244353
#define MX 1000000000
#define MXL 1000000000000000000
#define PI (ld)2*acos(0.0)
#define nax 200005
#define pb push_back
#define sc second
#define fr first
//#define int long long
//#define endl '\n'
#define ld long double
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl
/*
#define MAX_N 5000
#define MAX_CALLS 70000
#define fail(s, x...) do { \
fprintf(stderr, s "\n", ## x); \
exit(1); \
} while(0)
//Symbol obfuscation
#define N koala
#define realS kangaroo
#define realD possum
#define inv platypus
#define num_calls echidna
static int N;
static int realS[MAX_N];
static int realD[MAX_N];
static int inv[MAX_N];
static int num_calls;
void answer(int S[], int D[]) {
int i;
int correct = 1;
for (i = 0; i < N; ++i)
if (S[i] != realS[i] || D[i] != realD[i]) {
correct = 0;
break;
}
if (correct)
printf("CORRECT\n");
else
printf("INCORRECT\n");
for (i = 0; i < N; ++i) {
if (i > 0)
printf(" ");
printf("%d", S[i]);
}
printf("\n");
for (i = 0; i < N; ++i) {
if (i > 0)
printf(" ");
printf("%d", D[i]);
}
printf("\n");
exit(0);
}
int tryCombination(int S[]) {
int i;
if (num_calls >= MAX_CALLS) {
printf("INCORRECT\nToo many calls to tryCombination().\n");
exit(0);
}
++num_calls;
for (i = 0; i < N; ++i)
if (S[inv[i]] != realS[inv[i]])
return i;
return -1;
}
int init() {
int i, res;
res = scanf("%d", &N);
for (i = 0; i < N; ++i) {
res = scanf("%d", &realS[i]);
}
for (i = 0; i < N; ++i) {
res = scanf("%d", &realD[i]);
inv[realD[i]] = i;
}
num_calls = 0;
return N;
}
*/
void exploreCave(int n)
{
int set[n];
int lever[n];
for(int i = 0; i < n; i++)
{
set[i] = -1;
lever[i] = -1;
}
for(int door = 0; door < n; door++)
{
int q[n];
for(int i = 0; i < n; i++){
if(set[i] != -1)
{
q[i] = set[i];
}
else
{
q[i] = 0;
}
}
int now = tryCombination(q);
if(now != door){
now = 0;
}
else{
now = 1;
}
int modulo = 0;
for(int md = 2; md < 2*n; md*=2)
{
for(int i = 0; i < n; i++)
{
if(i%md == modulo)
{
q[i] = now;
}
else
{
q[i] = 1-now;
}
if(set[i] != -1)
{
q[i] = set[i];
}
}
int query = tryCombination(q);
if(query == door)
{
modulo+=md/2;
}
}
set[modulo] = now;
lever[modulo] = door;
}
answer(set, lever);
}
/*
int32_t main(){
startt
int N;
N = init();
exploreCave(N);
printf("INCORRECT\nYour solution did not call answer().\n");
return 0;
}
*/
/*
4
1 1 1 0
3 1 0 2
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1086 ms |
404 KB |
Output is correct |
2 |
Correct |
1168 ms |
400 KB |
Output is correct |
3 |
Correct |
1757 ms |
424 KB |
Output is correct |
4 |
Correct |
1224 ms |
404 KB |
Output is correct |
5 |
Correct |
1779 ms |
436 KB |
Output is correct |
6 |
Correct |
1756 ms |
432 KB |
Output is correct |
7 |
Correct |
1759 ms |
436 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
0 ms |
208 KB |
Output is correct |
12 |
Correct |
1756 ms |
424 KB |
Output is correct |
13 |
Correct |
1761 ms |
432 KB |
Output is correct |
14 |
Correct |
1763 ms |
420 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1778 ms |
552 KB |
Output is correct |
2 |
Correct |
0 ms |
208 KB |
Output is correct |
3 |
Correct |
1779 ms |
424 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
0 ms |
208 KB |
Output is correct |
6 |
Correct |
1778 ms |
436 KB |
Output is correct |
7 |
Correct |
1749 ms |
424 KB |
Output is correct |
8 |
Correct |
1777 ms |
420 KB |
Output is correct |
9 |
Correct |
1772 ms |
424 KB |
Output is correct |
10 |
Correct |
1767 ms |
428 KB |
Output is correct |
11 |
Correct |
1753 ms |
416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
304 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
208 KB |
Output is correct |
2 |
Correct |
0 ms |
304 KB |
Output is correct |
3 |
Correct |
1 ms |
208 KB |
Output is correct |
4 |
Correct |
0 ms |
208 KB |
Output is correct |
5 |
Correct |
1 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
208 KB |
Output is correct |
7 |
Correct |
1 ms |
208 KB |
Output is correct |
8 |
Correct |
1 ms |
208 KB |
Output is correct |
9 |
Correct |
1 ms |
208 KB |
Output is correct |
10 |
Correct |
1 ms |
208 KB |
Output is correct |
11 |
Correct |
1 ms |
208 KB |
Output is correct |
12 |
Correct |
1 ms |
208 KB |
Output is correct |
13 |
Correct |
1 ms |
208 KB |
Output is correct |
14 |
Correct |
0 ms |
208 KB |
Output is correct |
15 |
Correct |
0 ms |
300 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
0 ms |
208 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
1 ms |
208 KB |
Output is correct |
20 |
Correct |
234 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
300 KB |
Output is correct |
22 |
Correct |
1 ms |
208 KB |
Output is correct |
23 |
Correct |
237 ms |
336 KB |
Output is correct |
24 |
Correct |
235 ms |
336 KB |
Output is correct |
25 |
Correct |
237 ms |
356 KB |
Output is correct |
26 |
Correct |
1 ms |
208 KB |
Output is correct |
27 |
Correct |
1 ms |
208 KB |
Output is correct |
28 |
Correct |
233 ms |
336 KB |
Output is correct |
29 |
Correct |
1 ms |
208 KB |
Output is correct |
30 |
Correct |
236 ms |
344 KB |
Output is correct |
31 |
Correct |
237 ms |
344 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
1 ms |
208 KB |
Output is correct |
35 |
Correct |
236 ms |
344 KB |
Output is correct |
36 |
Correct |
236 ms |
340 KB |
Output is correct |
37 |
Correct |
0 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1086 ms |
404 KB |
Output is correct |
2 |
Correct |
1168 ms |
400 KB |
Output is correct |
3 |
Correct |
1757 ms |
424 KB |
Output is correct |
4 |
Correct |
1224 ms |
404 KB |
Output is correct |
5 |
Correct |
1779 ms |
436 KB |
Output is correct |
6 |
Correct |
1756 ms |
432 KB |
Output is correct |
7 |
Correct |
1759 ms |
436 KB |
Output is correct |
8 |
Correct |
0 ms |
208 KB |
Output is correct |
9 |
Correct |
0 ms |
208 KB |
Output is correct |
10 |
Correct |
0 ms |
208 KB |
Output is correct |
11 |
Correct |
0 ms |
208 KB |
Output is correct |
12 |
Correct |
1756 ms |
424 KB |
Output is correct |
13 |
Correct |
1761 ms |
432 KB |
Output is correct |
14 |
Correct |
1763 ms |
420 KB |
Output is correct |
15 |
Correct |
1778 ms |
552 KB |
Output is correct |
16 |
Correct |
0 ms |
208 KB |
Output is correct |
17 |
Correct |
1779 ms |
424 KB |
Output is correct |
18 |
Correct |
0 ms |
208 KB |
Output is correct |
19 |
Correct |
0 ms |
208 KB |
Output is correct |
20 |
Correct |
1778 ms |
436 KB |
Output is correct |
21 |
Correct |
1749 ms |
424 KB |
Output is correct |
22 |
Correct |
1777 ms |
420 KB |
Output is correct |
23 |
Correct |
1772 ms |
424 KB |
Output is correct |
24 |
Correct |
1767 ms |
428 KB |
Output is correct |
25 |
Correct |
1753 ms |
416 KB |
Output is correct |
26 |
Correct |
0 ms |
208 KB |
Output is correct |
27 |
Correct |
0 ms |
304 KB |
Output is correct |
28 |
Correct |
1 ms |
208 KB |
Output is correct |
29 |
Correct |
0 ms |
208 KB |
Output is correct |
30 |
Correct |
1 ms |
300 KB |
Output is correct |
31 |
Correct |
1 ms |
208 KB |
Output is correct |
32 |
Correct |
1 ms |
208 KB |
Output is correct |
33 |
Correct |
1 ms |
208 KB |
Output is correct |
34 |
Correct |
1 ms |
208 KB |
Output is correct |
35 |
Correct |
1 ms |
208 KB |
Output is correct |
36 |
Correct |
1 ms |
208 KB |
Output is correct |
37 |
Correct |
1 ms |
208 KB |
Output is correct |
38 |
Correct |
1 ms |
208 KB |
Output is correct |
39 |
Correct |
0 ms |
208 KB |
Output is correct |
40 |
Correct |
0 ms |
300 KB |
Output is correct |
41 |
Correct |
0 ms |
208 KB |
Output is correct |
42 |
Correct |
0 ms |
208 KB |
Output is correct |
43 |
Correct |
0 ms |
208 KB |
Output is correct |
44 |
Correct |
1 ms |
208 KB |
Output is correct |
45 |
Correct |
234 ms |
336 KB |
Output is correct |
46 |
Correct |
1 ms |
300 KB |
Output is correct |
47 |
Correct |
1 ms |
208 KB |
Output is correct |
48 |
Correct |
237 ms |
336 KB |
Output is correct |
49 |
Correct |
235 ms |
336 KB |
Output is correct |
50 |
Correct |
237 ms |
356 KB |
Output is correct |
51 |
Correct |
1 ms |
208 KB |
Output is correct |
52 |
Correct |
1 ms |
208 KB |
Output is correct |
53 |
Correct |
233 ms |
336 KB |
Output is correct |
54 |
Correct |
1 ms |
208 KB |
Output is correct |
55 |
Correct |
236 ms |
344 KB |
Output is correct |
56 |
Correct |
237 ms |
344 KB |
Output is correct |
57 |
Correct |
1 ms |
208 KB |
Output is correct |
58 |
Correct |
1 ms |
208 KB |
Output is correct |
59 |
Correct |
1 ms |
208 KB |
Output is correct |
60 |
Correct |
236 ms |
344 KB |
Output is correct |
61 |
Correct |
236 ms |
340 KB |
Output is correct |
62 |
Correct |
0 ms |
208 KB |
Output is correct |
63 |
Correct |
1091 ms |
404 KB |
Output is correct |
64 |
Correct |
1172 ms |
404 KB |
Output is correct |
65 |
Correct |
1758 ms |
436 KB |
Output is correct |
66 |
Correct |
1212 ms |
404 KB |
Output is correct |
67 |
Correct |
1769 ms |
424 KB |
Output is correct |
68 |
Correct |
1740 ms |
444 KB |
Output is correct |
69 |
Correct |
1752 ms |
428 KB |
Output is correct |
70 |
Correct |
1 ms |
208 KB |
Output is correct |
71 |
Correct |
0 ms |
208 KB |
Output is correct |
72 |
Correct |
1746 ms |
436 KB |
Output is correct |
73 |
Correct |
1745 ms |
420 KB |
Output is correct |
74 |
Correct |
1748 ms |
416 KB |
Output is correct |
75 |
Correct |
1765 ms |
424 KB |
Output is correct |
76 |
Correct |
0 ms |
208 KB |
Output is correct |
77 |
Correct |
0 ms |
208 KB |
Output is correct |
78 |
Correct |
1756 ms |
436 KB |
Output is correct |
79 |
Correct |
1766 ms |
420 KB |
Output is correct |
80 |
Correct |
1772 ms |
420 KB |
Output is correct |
81 |
Correct |
1793 ms |
424 KB |
Output is correct |
82 |
Correct |
1781 ms |
420 KB |
Output is correct |
83 |
Correct |
1783 ms |
420 KB |
Output is correct |
84 |
Correct |
1 ms |
208 KB |
Output is correct |
85 |
Correct |
235 ms |
336 KB |
Output is correct |
86 |
Correct |
1741 ms |
420 KB |
Output is correct |
87 |
Correct |
1 ms |
208 KB |
Output is correct |
88 |
Correct |
1 ms |
208 KB |
Output is correct |
89 |
Correct |
235 ms |
340 KB |
Output is correct |
90 |
Correct |
237 ms |
344 KB |
Output is correct |
91 |
Correct |
237 ms |
340 KB |
Output is correct |
92 |
Correct |
1760 ms |
456 KB |
Output is correct |
93 |
Correct |
1779 ms |
456 KB |
Output is correct |
94 |
Correct |
1763 ms |
420 KB |
Output is correct |
95 |
Correct |
1 ms |
208 KB |
Output is correct |
96 |
Correct |
1 ms |
208 KB |
Output is correct |
97 |
Correct |
1751 ms |
432 KB |
Output is correct |
98 |
Correct |
239 ms |
456 KB |
Output is correct |
99 |
Correct |
1754 ms |
456 KB |
Output is correct |
100 |
Correct |
1 ms |
208 KB |
Output is correct |
101 |
Correct |
236 ms |
312 KB |
Output is correct |
102 |
Correct |
236 ms |
336 KB |
Output is correct |
103 |
Correct |
1750 ms |
420 KB |
Output is correct |
104 |
Correct |
1 ms |
208 KB |
Output is correct |
105 |
Correct |
1 ms |
208 KB |
Output is correct |
106 |
Correct |
1 ms |
208 KB |
Output is correct |
107 |
Correct |
241 ms |
336 KB |
Output is correct |
108 |
Correct |
235 ms |
336 KB |
Output is correct |
109 |
Correct |
1785 ms |
424 KB |
Output is correct |
110 |
Correct |
1774 ms |
420 KB |
Output is correct |
111 |
Correct |
1 ms |
296 KB |
Output is correct |