답안 #630709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
630709 2022-08-17T00:29:07 Z SorahISA 동굴 (IOI13_cave) C++17
100 / 100
219 ms 680 KB
#include "cave.h"

// #pragma GCC target("avx2")
#pragma GCC optimize("Ofast", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

// #define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int maxn = 5000 + 5;

// void answer(int S[], int D[]);
// int tryCombination(int S[]);

int ans[maxn], pls[maxn], tmp[maxn];

void exploreCave(int N) {
    memset(ans, 0xff, sizeof(ans));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) tmp[j] = ans[j] >= 0 ? ans[j] : 1;
        int on = tryCombination(tmp);
        int st = on > i or on == -1;
        
        int lo = 0, hi = N-1, mi, ret;
        while (lo < hi) {
            mi = lo + hi >> 1;
            for (int j = 0; j < N; ++j) tmp[j] = ans[j] >= 0 ? ans[j] : (j > mi) ^ st;
            ret = tryCombination(tmp);
            if (ret > i or ret == -1) hi = mi;
            else                      lo = mi + 1;
        }
        pls[lo] = i;
        ans[lo] = st;
    }
    answer(ans, pls);
}

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:50:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   50 |             mi = lo + hi >> 1;
      |                  ~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 420 KB Output is correct
2 Correct 116 ms 412 KB Output is correct
3 Correct 186 ms 552 KB Output is correct
4 Correct 127 ms 544 KB Output is correct
5 Correct 183 ms 424 KB Output is correct
6 Correct 175 ms 428 KB Output is correct
7 Correct 180 ms 548 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 180 ms 436 KB Output is correct
13 Correct 176 ms 432 KB Output is correct
14 Correct 187 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 185 ms 432 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 192 ms 436 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 312 KB Output is correct
6 Correct 179 ms 428 KB Output is correct
7 Correct 219 ms 420 KB Output is correct
8 Correct 189 ms 432 KB Output is correct
9 Correct 191 ms 340 KB Output is correct
10 Correct 188 ms 448 KB Output is correct
11 Correct 216 ms 420 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 308 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 308 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 308 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 0 ms 340 KB Output is correct
15 Correct 0 ms 304 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 0 ms 340 KB Output is correct
20 Correct 26 ms 380 KB Output is correct
21 Correct 0 ms 340 KB Output is correct
22 Correct 1 ms 308 KB Output is correct
23 Correct 26 ms 340 KB Output is correct
24 Correct 26 ms 384 KB Output is correct
25 Correct 26 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 26 ms 388 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 28 ms 376 KB Output is correct
31 Correct 26 ms 388 KB Output is correct
32 Correct 0 ms 340 KB Output is correct
33 Correct 0 ms 340 KB Output is correct
34 Correct 0 ms 308 KB Output is correct
35 Correct 26 ms 340 KB Output is correct
36 Correct 26 ms 392 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 420 KB Output is correct
2 Correct 116 ms 412 KB Output is correct
3 Correct 186 ms 552 KB Output is correct
4 Correct 127 ms 544 KB Output is correct
5 Correct 183 ms 424 KB Output is correct
6 Correct 175 ms 428 KB Output is correct
7 Correct 180 ms 548 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 180 ms 436 KB Output is correct
13 Correct 176 ms 432 KB Output is correct
14 Correct 187 ms 428 KB Output is correct
15 Correct 185 ms 432 KB Output is correct
16 Correct 0 ms 340 KB Output is correct
17 Correct 192 ms 436 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 312 KB Output is correct
20 Correct 179 ms 428 KB Output is correct
21 Correct 219 ms 420 KB Output is correct
22 Correct 189 ms 432 KB Output is correct
23 Correct 191 ms 340 KB Output is correct
24 Correct 188 ms 448 KB Output is correct
25 Correct 216 ms 420 KB Output is correct
26 Correct 0 ms 308 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 0 ms 340 KB Output is correct
29 Correct 0 ms 340 KB Output is correct
30 Correct 0 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 308 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 308 KB Output is correct
36 Correct 1 ms 340 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 0 ms 340 KB Output is correct
40 Correct 0 ms 304 KB Output is correct
41 Correct 0 ms 340 KB Output is correct
42 Correct 0 ms 340 KB Output is correct
43 Correct 1 ms 340 KB Output is correct
44 Correct 0 ms 340 KB Output is correct
45 Correct 26 ms 380 KB Output is correct
46 Correct 0 ms 340 KB Output is correct
47 Correct 1 ms 308 KB Output is correct
48 Correct 26 ms 340 KB Output is correct
49 Correct 26 ms 384 KB Output is correct
50 Correct 26 ms 340 KB Output is correct
51 Correct 1 ms 340 KB Output is correct
52 Correct 1 ms 340 KB Output is correct
53 Correct 26 ms 388 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 28 ms 376 KB Output is correct
56 Correct 26 ms 388 KB Output is correct
57 Correct 0 ms 340 KB Output is correct
58 Correct 0 ms 340 KB Output is correct
59 Correct 0 ms 308 KB Output is correct
60 Correct 26 ms 340 KB Output is correct
61 Correct 26 ms 392 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 123 ms 424 KB Output is correct
64 Correct 122 ms 540 KB Output is correct
65 Correct 187 ms 340 KB Output is correct
66 Correct 121 ms 432 KB Output is correct
67 Correct 178 ms 548 KB Output is correct
68 Correct 184 ms 556 KB Output is correct
69 Correct 183 ms 420 KB Output is correct
70 Correct 0 ms 312 KB Output is correct
71 Correct 0 ms 340 KB Output is correct
72 Correct 177 ms 552 KB Output is correct
73 Correct 180 ms 680 KB Output is correct
74 Correct 180 ms 340 KB Output is correct
75 Correct 185 ms 432 KB Output is correct
76 Correct 0 ms 340 KB Output is correct
77 Correct 0 ms 312 KB Output is correct
78 Correct 186 ms 428 KB Output is correct
79 Correct 216 ms 436 KB Output is correct
80 Correct 189 ms 340 KB Output is correct
81 Correct 196 ms 432 KB Output is correct
82 Correct 189 ms 436 KB Output is correct
83 Correct 216 ms 440 KB Output is correct
84 Correct 1 ms 340 KB Output is correct
85 Correct 26 ms 388 KB Output is correct
86 Correct 186 ms 544 KB Output is correct
87 Correct 1 ms 340 KB Output is correct
88 Correct 1 ms 340 KB Output is correct
89 Correct 26 ms 320 KB Output is correct
90 Correct 27 ms 388 KB Output is correct
91 Correct 26 ms 392 KB Output is correct
92 Correct 189 ms 340 KB Output is correct
93 Correct 190 ms 448 KB Output is correct
94 Correct 188 ms 340 KB Output is correct
95 Correct 1 ms 340 KB Output is correct
96 Correct 1 ms 340 KB Output is correct
97 Correct 178 ms 340 KB Output is correct
98 Correct 25 ms 392 KB Output is correct
99 Correct 177 ms 428 KB Output is correct
100 Correct 1 ms 340 KB Output is correct
101 Correct 27 ms 388 KB Output is correct
102 Correct 26 ms 340 KB Output is correct
103 Correct 182 ms 436 KB Output is correct
104 Correct 0 ms 340 KB Output is correct
105 Correct 1 ms 340 KB Output is correct
106 Correct 1 ms 340 KB Output is correct
107 Correct 27 ms 340 KB Output is correct
108 Correct 27 ms 388 KB Output is correct
109 Correct 191 ms 432 KB Output is correct
110 Correct 206 ms 340 KB Output is correct
111 Correct 1 ms 340 KB Output is correct