답안 #782256

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
782256 2023-07-13T16:43:50 Z Minindu206 동굴 (IOI13_cave) C++14
46 / 100
63 ms 440 KB
#include "cave.h"
#include <bits/stdc++.h>
using namespace std;
void exploreCave(int n)
{
    int sw[n], st[n], temp[n];
    for (int i = 0; i < n; i++)
        st[i] = 0, sw[i] = -1;
    int cc = tryCombination(st);
    if (cc == -1)
    {
        memset(temp, 0, sizeof(temp));
        for (int i = 0; i < n; i++)
        {
            temp[i] = 1;
            cc = tryCombination(temp);
            sw[i] = cc;
            temp[i] = 0;
        }
    }
    for (int i = 0; i < n; i++)
    {
        int cmb = tryCombination(st), swt = 1;
        if (cmb == -1)
            cmb = n;
        if (cmb > i || cmb == -1)
            swt = 0;
        // st[i] = swt;
        memset(temp, 1 - swt, sizeof(temp));
        for (int j = 0; j < n; j++)
        {
            if (sw[j] != -1)
                temp[j] = st[j];
        }
        for (int j = 0; j < n; j++)
        {
            if (sw[j] != -1)
                continue;
            temp[j] = swt;
            cmb = tryCombination(temp);
            if (cmb > i || cmb == -1)
            {
                sw[j] = i;
                st[j] = swt;
                break;
            }
            temp[j] = 1 - temp[j];
        }
        // for(int j=0;j<n;j++)
        //     cout << st[i] << " ";
        // cout << '\n';

        // for(int j=0;j<n;j++)
        //     cout << sw[i] << " ";
        // cout << '\n';
    }
    answer(st, sw);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 340 KB Output is correct
2 Correct 26 ms 340 KB Output is correct
3 Correct 38 ms 340 KB Output is correct
4 Correct 29 ms 380 KB Output is correct
5 Correct 53 ms 400 KB Output is correct
6 Correct 38 ms 388 KB Output is correct
7 Correct 52 ms 392 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 38 ms 340 KB Output is correct
13 Correct 38 ms 340 KB Output is correct
14 Correct 38 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 400 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 56 ms 404 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 63 ms 440 KB Output is correct
7 Correct 51 ms 428 KB Output is correct
8 Correct 53 ms 340 KB Output is correct
9 Correct 54 ms 436 KB Output is correct
10 Correct 54 ms 340 KB Output is correct
11 Correct 59 ms 436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Incorrect 1 ms 340 KB too much calls on tryCombination()
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 26 ms 340 KB Output is correct
2 Correct 26 ms 340 KB Output is correct
3 Correct 38 ms 340 KB Output is correct
4 Correct 29 ms 380 KB Output is correct
5 Correct 53 ms 400 KB Output is correct
6 Correct 38 ms 388 KB Output is correct
7 Correct 52 ms 392 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 38 ms 340 KB Output is correct
13 Correct 38 ms 340 KB Output is correct
14 Correct 38 ms 340 KB Output is correct
15 Correct 51 ms 400 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 56 ms 404 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 63 ms 440 KB Output is correct
21 Correct 51 ms 428 KB Output is correct
22 Correct 53 ms 340 KB Output is correct
23 Correct 54 ms 436 KB Output is correct
24 Correct 54 ms 340 KB Output is correct
25 Correct 59 ms 436 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 1 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 212 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 212 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Incorrect 1 ms 340 KB too much calls on tryCombination()
46 Halted 0 ms 0 KB -