# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
1070818 |
2024-08-22T19:04:13 Z |
dosts |
동굴 (IOI13_cave) |
C++17 |
|
421 ms |
880 KB |
//Dost SEFEROĞLU
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
//#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " <<
#define all(cont) cont.begin(),cont.end()
#define vi vector<int>
const int MOD = 1e9+7,inf = 2e18;
const int N = 1e5+50;
void exploreCave(int32_t N) {
vector<pii> fix;
int R[N],D[N];
for (int i=0;i<N;i++) {
int S[N];
for (int j=0;j<N;j++) S[j] = 0;
for (auto it : fix) {
S[it.ff] = it.ss;
}
int real = tryCombination(S);
if (real == -1) real = N;
int l = 1;
int r = N;
if (real == i) {
while (l<=r) {
int m = (l+r) >> 1;
int SS[N];
for (int j=0;j<m;j++) SS[j] = S[j]^1;
for (int j=m;j<N;j++) SS[j] = S[j];
for (auto it : fix) SS[it.ff] = it.ss;
int test = tryCombination(SS);
if (test == -1) test = N;
if (test > real) {
r = m-1;
}
else l = m+1;
}
}
else {
while (l<=r) {
int m = (l+r) >> 1;
int SS[N];
for (int j=0;j<m;j++) SS[j] = S[j]^1;
for (int j=m;j<N;j++) SS[j] = S[j];
for (auto it : fix) SS[it.ff] = it.ss;
int test = tryCombination(SS);
if (test == -1) test = N;
if (test == i) {
r = m-1;
}
else l = m+1;
}
}
if (real > i) fix.push_back({l-1,0});
else fix.push_back({l-1,1});
R[fix.back().ff] = i;
D[fix.back().ff] = fix.back().ss;
}
answer(D,R);
}
Compilation message
cave.cpp:12:29: warning: overflow in conversion from 'double' to 'int' changes value from '2.0e+18' to '2147483647' [-Woverflow]
12 | const int MOD = 1e9+7,inf = 2e18;
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
222 ms |
592 KB |
Output is correct |
2 |
Correct |
195 ms |
604 KB |
Output is correct |
3 |
Correct |
297 ms |
880 KB |
Output is correct |
4 |
Correct |
197 ms |
600 KB |
Output is correct |
5 |
Correct |
421 ms |
856 KB |
Output is correct |
6 |
Correct |
331 ms |
600 KB |
Output is correct |
7 |
Correct |
402 ms |
612 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
330 ms |
612 KB |
Output is correct |
13 |
Correct |
316 ms |
848 KB |
Output is correct |
14 |
Correct |
354 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
392 ms |
612 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
364 ms |
608 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
387 ms |
612 KB |
Output is correct |
7 |
Correct |
345 ms |
600 KB |
Output is correct |
8 |
Correct |
344 ms |
600 KB |
Output is correct |
9 |
Correct |
380 ms |
848 KB |
Output is correct |
10 |
Correct |
343 ms |
452 KB |
Output is correct |
11 |
Correct |
355 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
444 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 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 |
0 ms |
444 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
452 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
1 ms |
348 KB |
Output is correct |
20 |
Correct |
42 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Correct |
1 ms |
348 KB |
Output is correct |
23 |
Correct |
44 ms |
536 KB |
Output is correct |
24 |
Correct |
44 ms |
344 KB |
Output is correct |
25 |
Correct |
45 ms |
348 KB |
Output is correct |
26 |
Correct |
1 ms |
344 KB |
Output is correct |
27 |
Correct |
1 ms |
348 KB |
Output is correct |
28 |
Correct |
43 ms |
540 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
44 ms |
348 KB |
Output is correct |
31 |
Correct |
44 ms |
348 KB |
Output is correct |
32 |
Correct |
1 ms |
348 KB |
Output is correct |
33 |
Correct |
1 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
45 ms |
348 KB |
Output is correct |
36 |
Correct |
55 ms |
520 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
222 ms |
592 KB |
Output is correct |
2 |
Correct |
195 ms |
604 KB |
Output is correct |
3 |
Correct |
297 ms |
880 KB |
Output is correct |
4 |
Correct |
197 ms |
600 KB |
Output is correct |
5 |
Correct |
421 ms |
856 KB |
Output is correct |
6 |
Correct |
331 ms |
600 KB |
Output is correct |
7 |
Correct |
402 ms |
612 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
344 KB |
Output is correct |
12 |
Correct |
330 ms |
612 KB |
Output is correct |
13 |
Correct |
316 ms |
848 KB |
Output is correct |
14 |
Correct |
354 ms |
604 KB |
Output is correct |
15 |
Correct |
392 ms |
612 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
364 ms |
608 KB |
Output is correct |
18 |
Correct |
0 ms |
344 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
387 ms |
612 KB |
Output is correct |
21 |
Correct |
345 ms |
600 KB |
Output is correct |
22 |
Correct |
344 ms |
600 KB |
Output is correct |
23 |
Correct |
380 ms |
848 KB |
Output is correct |
24 |
Correct |
343 ms |
452 KB |
Output is correct |
25 |
Correct |
355 ms |
604 KB |
Output is correct |
26 |
Correct |
0 ms |
348 KB |
Output is correct |
27 |
Correct |
0 ms |
348 KB |
Output is correct |
28 |
Correct |
0 ms |
348 KB |
Output is correct |
29 |
Correct |
0 ms |
348 KB |
Output is correct |
30 |
Correct |
0 ms |
444 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
348 KB |
Output is correct |
34 |
Correct |
0 ms |
348 KB |
Output is correct |
35 |
Correct |
0 ms |
348 KB |
Output is correct |
36 |
Correct |
1 ms |
348 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
0 ms |
348 KB |
Output is correct |
39 |
Correct |
0 ms |
348 KB |
Output is correct |
40 |
Correct |
1 ms |
452 KB |
Output is correct |
41 |
Correct |
1 ms |
348 KB |
Output is correct |
42 |
Correct |
0 ms |
348 KB |
Output is correct |
43 |
Correct |
0 ms |
348 KB |
Output is correct |
44 |
Correct |
1 ms |
348 KB |
Output is correct |
45 |
Correct |
42 ms |
348 KB |
Output is correct |
46 |
Correct |
0 ms |
348 KB |
Output is correct |
47 |
Correct |
1 ms |
348 KB |
Output is correct |
48 |
Correct |
44 ms |
536 KB |
Output is correct |
49 |
Correct |
44 ms |
344 KB |
Output is correct |
50 |
Correct |
45 ms |
348 KB |
Output is correct |
51 |
Correct |
1 ms |
344 KB |
Output is correct |
52 |
Correct |
1 ms |
348 KB |
Output is correct |
53 |
Correct |
43 ms |
540 KB |
Output is correct |
54 |
Correct |
0 ms |
348 KB |
Output is correct |
55 |
Correct |
44 ms |
348 KB |
Output is correct |
56 |
Correct |
44 ms |
348 KB |
Output is correct |
57 |
Correct |
1 ms |
348 KB |
Output is correct |
58 |
Correct |
1 ms |
348 KB |
Output is correct |
59 |
Correct |
0 ms |
348 KB |
Output is correct |
60 |
Correct |
45 ms |
348 KB |
Output is correct |
61 |
Correct |
55 ms |
520 KB |
Output is correct |
62 |
Correct |
1 ms |
344 KB |
Output is correct |
63 |
Correct |
219 ms |
596 KB |
Output is correct |
64 |
Correct |
189 ms |
600 KB |
Output is correct |
65 |
Correct |
289 ms |
604 KB |
Output is correct |
66 |
Correct |
198 ms |
600 KB |
Output is correct |
67 |
Correct |
392 ms |
604 KB |
Output is correct |
68 |
Correct |
315 ms |
600 KB |
Output is correct |
69 |
Correct |
389 ms |
608 KB |
Output is correct |
70 |
Correct |
1 ms |
344 KB |
Output is correct |
71 |
Correct |
0 ms |
348 KB |
Output is correct |
72 |
Correct |
317 ms |
616 KB |
Output is correct |
73 |
Correct |
315 ms |
612 KB |
Output is correct |
74 |
Correct |
311 ms |
608 KB |
Output is correct |
75 |
Correct |
354 ms |
604 KB |
Output is correct |
76 |
Correct |
0 ms |
344 KB |
Output is correct |
77 |
Correct |
1 ms |
348 KB |
Output is correct |
78 |
Correct |
384 ms |
604 KB |
Output is correct |
79 |
Correct |
355 ms |
856 KB |
Output is correct |
80 |
Correct |
346 ms |
600 KB |
Output is correct |
81 |
Correct |
346 ms |
612 KB |
Output is correct |
82 |
Correct |
348 ms |
604 KB |
Output is correct |
83 |
Correct |
347 ms |
604 KB |
Output is correct |
84 |
Correct |
1 ms |
348 KB |
Output is correct |
85 |
Correct |
59 ms |
348 KB |
Output is correct |
86 |
Correct |
298 ms |
696 KB |
Output is correct |
87 |
Correct |
1 ms |
344 KB |
Output is correct |
88 |
Correct |
0 ms |
348 KB |
Output is correct |
89 |
Correct |
45 ms |
348 KB |
Output is correct |
90 |
Correct |
44 ms |
344 KB |
Output is correct |
91 |
Correct |
49 ms |
348 KB |
Output is correct |
92 |
Correct |
324 ms |
608 KB |
Output is correct |
93 |
Correct |
311 ms |
600 KB |
Output is correct |
94 |
Correct |
331 ms |
612 KB |
Output is correct |
95 |
Correct |
1 ms |
344 KB |
Output is correct |
96 |
Correct |
1 ms |
348 KB |
Output is correct |
97 |
Correct |
310 ms |
604 KB |
Output is correct |
98 |
Correct |
43 ms |
516 KB |
Output is correct |
99 |
Correct |
309 ms |
688 KB |
Output is correct |
100 |
Correct |
1 ms |
348 KB |
Output is correct |
101 |
Correct |
44 ms |
520 KB |
Output is correct |
102 |
Correct |
46 ms |
348 KB |
Output is correct |
103 |
Correct |
316 ms |
608 KB |
Output is correct |
104 |
Correct |
1 ms |
344 KB |
Output is correct |
105 |
Correct |
1 ms |
348 KB |
Output is correct |
106 |
Correct |
1 ms |
440 KB |
Output is correct |
107 |
Correct |
44 ms |
344 KB |
Output is correct |
108 |
Correct |
47 ms |
348 KB |
Output is correct |
109 |
Correct |
329 ms |
600 KB |
Output is correct |
110 |
Correct |
336 ms |
604 KB |
Output is correct |
111 |
Correct |
0 ms |
348 KB |
Output is correct |