답안 #1091560

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1091560 2024-09-21T09:15:10 Z AndreasK 동굴 (IOI13_cave) C++14
0 / 100
1 ms 600 KB
#include <bits/stdc++.h>
#include <cave.h>

using namespace std;

#define designed ios_base::sync_with_stdio(0);
#define by cin.tie(0);
#define AndreasK cout.tie(0);
//#define int long long
#define ii pair <int, int>
#define vi vector <int>
#define iii pair <int, ii>
#define vii vector <ii>
#define vc vector <char>
#define vb vector <bool>

/*
int n;

int tryCombination(int a[]) {
    int ansa[] = {1, 0, 0, 1};
    int ansb[] = {2, 1, 0, 3};
    int mn = 4;
    for (int c = 0; c < n; c++) {
        if (a[c] != ansa[c]) {
            mn = min(mn, ansb[c]);
        }
    }
    if (mn == 4)
        mn = -1;
    return mn;
}

void answer(int a[], int b[]) {
    for (int c = 0; c < n; c++)
        cout << a[c] << ' ';
    cout << '\n';
    for (int c = 0; c < n; c++)
        cout << b[c] << ' ';
    cout << '\n';
}*/

void exploreCave(int n) {
    int a[n] = {}, b[n];
    stack <int> s;
    int x = tryCombination(a);
    if (x == -1)
        x = n;
    for (int c = 0; c < n; c++) {
        int prevx = x;
        a[c] ^= 1;
        x = tryCombination(a);
        if (x == -1)
            x = n;
        if (x > prevx) {
            while (!s.empty()) {
                a[s.top()] ^= 1;
                prevx = x;
                x = tryCombination(a);
                if (x == -1)
                    x = n;
                if (x <= prevx) {
                    a[s.top()] ^= 1;
                    break;
                }
                else {
                    s.pop();
                }
            }
        }
        else if (x == prevx) {
            s.push(c);
            a[c] ^= 1;
        }
        else {
            a[c] ^= 1;
        }
    }
    if (tryCombination(a) != -1) {
        a[n - 1] ^= 1;
    }
    for (int c = 0; c < n; c++) {
        a[c] ^= 1;
        x = tryCombination(a);
        a[c] ^= 1;
        b[c] = x;
    }
    answer(a, b);
}

/*int32_t main() {
    //designed by AndreasK
    cin >> n;
    exploreCave(n);
    return 0;
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 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 344 KB Output is correct
5 Incorrect 0 ms 348 KB Answer is wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 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 344 KB Output is correct
5 Incorrect 0 ms 348 KB Answer is wrong
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Answer is wrong
2 Halted 0 ms 0 KB -