Submission #1015004

# Submission time Handle Problem Language Result Execution time Memory
1015004 2024-07-05T22:58:31 Z Mardonbekhazratov Cave (IOI13_cave) C++17
100 / 100
245 ms 1112 KB
#include "cave.h"
#include<iostream>
#include<set>
#include<vector>
const int maxN=5e3+1;

int n;
int S[maxN],D[maxN];
std::set<int>s;

void solve(int x){
    int ans=tryCombination(S);
    std::vector<int>a;
    for(int k:s) a.push_back(k);
    if(ans==x){
        int l=0,r=(int)a.size()-1;
        while(r>l){
            int mid=(l+r)/2;
            for(int j=0;j<=mid;j++){
                S[a[j]]=1;
            }
            if(tryCombination(S)!=x) r=mid;
            else l=mid+1;
            for(int j=0;j<=mid;j++){
                S[a[j]]=0;
            }
        }
        D[a[l]]=x;
        S[a[l]]=1;
        s.erase(a[l]);
        return;
    }
        int l=0,r=(int)a.size()-1;
        while(r>l){
            int mid=(l+r)/2;
            for(int j=0;j<=mid;j++){
                S[a[j]]=1;
            }
            if(tryCombination(S)==x) r=mid;
            else l=mid+1;
            for(int j=0;j<=mid;j++){
                S[a[j]]=0;
            }
        }
        D[a[l]]=x;
        S[a[l]]=0;
        s.erase(a[l]);
}

void exploreCave(int N) {
    n=N;
    for(int i=0;i<n;i++) s.insert(i),D[i]=-1,S[i]=0;
    for(int i=0;i<n;i++){
        solve(i);
    }
    answer(S,D);
}
# Verdict Execution time Memory Grader output
1 Correct 93 ms 712 KB Output is correct
2 Correct 112 ms 604 KB Output is correct
3 Correct 162 ms 856 KB Output is correct
4 Correct 101 ms 788 KB Output is correct
5 Correct 154 ms 1112 KB Output is correct
6 Correct 148 ms 856 KB Output is correct
7 Correct 145 ms 860 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 448 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 151 ms 604 KB Output is correct
13 Correct 152 ms 860 KB Output is correct
14 Correct 153 ms 772 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 157 ms 860 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 207 ms 840 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 166 ms 864 KB Output is correct
7 Correct 244 ms 856 KB Output is correct
8 Correct 209 ms 832 KB Output is correct
9 Correct 211 ms 832 KB Output is correct
10 Correct 226 ms 856 KB Output is correct
11 Correct 241 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 444 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 444 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 444 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 444 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 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 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 0 ms 348 KB Output is correct
20 Correct 31 ms 600 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 28 ms 604 KB Output is correct
24 Correct 29 ms 604 KB Output is correct
25 Correct 28 ms 452 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 22 ms 604 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 32 ms 616 KB Output is correct
31 Correct 31 ms 604 KB Output is correct
32 Correct 0 ms 344 KB Output is correct
33 Correct 0 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 28 ms 604 KB Output is correct
36 Correct 26 ms 600 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 93 ms 712 KB Output is correct
2 Correct 112 ms 604 KB Output is correct
3 Correct 162 ms 856 KB Output is correct
4 Correct 101 ms 788 KB Output is correct
5 Correct 154 ms 1112 KB Output is correct
6 Correct 148 ms 856 KB Output is correct
7 Correct 145 ms 860 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 448 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 151 ms 604 KB Output is correct
13 Correct 152 ms 860 KB Output is correct
14 Correct 153 ms 772 KB Output is correct
15 Correct 157 ms 860 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Correct 207 ms 840 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 166 ms 864 KB Output is correct
21 Correct 244 ms 856 KB Output is correct
22 Correct 209 ms 832 KB Output is correct
23 Correct 211 ms 832 KB Output is correct
24 Correct 226 ms 856 KB Output is correct
25 Correct 241 ms 860 KB Output is correct
26 Correct 0 ms 344 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 444 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 0 ms 348 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 0 ms 444 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 0 ms 348 KB Output is correct
38 Correct 0 ms 344 KB Output is correct
39 Correct 0 ms 348 KB Output is correct
40 Correct 0 ms 348 KB Output is correct
41 Correct 0 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 0 ms 348 KB Output is correct
45 Correct 31 ms 600 KB Output is correct
46 Correct 0 ms 344 KB Output is correct
47 Correct 0 ms 348 KB Output is correct
48 Correct 28 ms 604 KB Output is correct
49 Correct 29 ms 604 KB Output is correct
50 Correct 28 ms 452 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 0 ms 348 KB Output is correct
53 Correct 22 ms 604 KB Output is correct
54 Correct 0 ms 348 KB Output is correct
55 Correct 32 ms 616 KB Output is correct
56 Correct 31 ms 604 KB Output is correct
57 Correct 0 ms 344 KB Output is correct
58 Correct 0 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 28 ms 604 KB Output is correct
61 Correct 26 ms 600 KB Output is correct
62 Correct 1 ms 348 KB Output is correct
63 Correct 111 ms 760 KB Output is correct
64 Correct 96 ms 776 KB Output is correct
65 Correct 160 ms 604 KB Output is correct
66 Correct 108 ms 600 KB Output is correct
67 Correct 156 ms 600 KB Output is correct
68 Correct 151 ms 856 KB Output is correct
69 Correct 155 ms 856 KB Output is correct
70 Correct 0 ms 344 KB Output is correct
71 Correct 0 ms 348 KB Output is correct
72 Correct 153 ms 856 KB Output is correct
73 Correct 168 ms 856 KB Output is correct
74 Correct 158 ms 860 KB Output is correct
75 Correct 220 ms 832 KB Output is correct
76 Correct 1 ms 348 KB Output is correct
77 Correct 0 ms 348 KB Output is correct
78 Correct 172 ms 860 KB Output is correct
79 Correct 245 ms 860 KB Output is correct
80 Correct 219 ms 852 KB Output is correct
81 Correct 217 ms 600 KB Output is correct
82 Correct 214 ms 600 KB Output is correct
83 Correct 240 ms 600 KB Output is correct
84 Correct 1 ms 344 KB Output is correct
85 Correct 31 ms 600 KB Output is correct
86 Correct 218 ms 860 KB Output is correct
87 Correct 1 ms 344 KB Output is correct
88 Correct 1 ms 600 KB Output is correct
89 Correct 34 ms 612 KB Output is correct
90 Correct 40 ms 604 KB Output is correct
91 Correct 28 ms 604 KB Output is correct
92 Correct 199 ms 604 KB Output is correct
93 Correct 205 ms 604 KB Output is correct
94 Correct 203 ms 600 KB Output is correct
95 Correct 0 ms 344 KB Output is correct
96 Correct 0 ms 348 KB Output is correct
97 Correct 192 ms 836 KB Output is correct
98 Correct 22 ms 604 KB Output is correct
99 Correct 150 ms 856 KB Output is correct
100 Correct 0 ms 348 KB Output is correct
101 Correct 33 ms 616 KB Output is correct
102 Correct 31 ms 604 KB Output is correct
103 Correct 197 ms 860 KB Output is correct
104 Correct 0 ms 348 KB Output is correct
105 Correct 0 ms 348 KB Output is correct
106 Correct 0 ms 600 KB Output is correct
107 Correct 29 ms 604 KB Output is correct
108 Correct 28 ms 600 KB Output is correct
109 Correct 208 ms 852 KB Output is correct
110 Correct 200 ms 600 KB Output is correct
111 Correct 1 ms 348 KB Output is correct