Submission #1002239

# Submission time Handle Problem Language Result Execution time Memory
1002239 2024-06-19T11:18:53 Z toast12 Cave (IOI13_cave) C++14
33 / 100
62 ms 744 KB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;

void exploreCave(int N) {
    int s[N], d[N];
    set<int> a;
    for (int i = 0; i < N; i++) {
        s[i] = -1;
        d[i] = -1;
        a.insert(i);
    }
    // iterate over all doors and find out which switch opens the ith door
    for (int i = 0; i < N; i++) {
        // find which switch unlocks door i
        for (auto it = a.begin(); it != a.end(); it++) {
            int j = *it;
            if (s[j] != -1)
                continue;
            // try setting the current switch to down position
            s[j] = 0;
            int x = tryCombination(s);
            if (x == i+1 || x == -1) {
                // the current switch unlocks the current door
                d[j] = i;
                break;
            }
            // try setting the switch to up position
            s[j] = 1;
            x = tryCombination(s);
            if (x == i+1 || x == -1) {
                d[j] = i;
                break;
            }
            s[j] = -1;
        }
    }
    answer(s, d);
}
# Verdict Execution time Memory Grader output
1 Correct 38 ms 600 KB Output is correct
2 Correct 40 ms 604 KB Output is correct
3 Correct 62 ms 604 KB Output is correct
4 Correct 47 ms 604 KB Output is correct
5 Correct 57 ms 736 KB Output is correct
6 Correct 61 ms 604 KB Output is correct
7 Correct 51 ms 740 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 60 ms 744 KB Output is correct
13 Correct 56 ms 604 KB Output is correct
14 Correct 56 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 54 ms 604 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 1 ms 604 KB too much calls on tryCombination()
4 Halted 0 ms 0 KB -
# 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 348 KB Output is correct
5 Correct 1 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 348 KB Output is correct
9 Correct 0 ms 412 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 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 348 KB Output is correct
5 Correct 1 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 348 KB Output is correct
9 Correct 0 ms 412 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 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 Incorrect 1 ms 344 KB too much calls on tryCombination()
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 38 ms 600 KB Output is correct
2 Correct 40 ms 604 KB Output is correct
3 Correct 62 ms 604 KB Output is correct
4 Correct 47 ms 604 KB Output is correct
5 Correct 57 ms 736 KB Output is correct
6 Correct 61 ms 604 KB Output is correct
7 Correct 51 ms 740 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 60 ms 744 KB Output is correct
13 Correct 56 ms 604 KB Output is correct
14 Correct 56 ms 600 KB Output is correct
15 Correct 54 ms 604 KB Output is correct
16 Correct 0 ms 344 KB Output is correct
17 Incorrect 1 ms 604 KB too much calls on tryCombination()
18 Halted 0 ms 0 KB -