답안 #1068623

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1068623 2024-08-21T11:00:04 Z TheQuantiX 자동 인형 (IOI18_doll) C++17
37 / 100
99 ms 8772 KB
#include <bits/stdc++.h>
#include "doll.h"

using namespace std;
using ll = long long;

constexpr ll INF = 1000000000 - 1;

ll nxt = -2;

void create_circuit(int M, vector<int> A) {
    ll NN = A.size();
    A.push_back(-1);
    ll N = A.size();
    ll ex = 1;
    while (ex < N) {
        ex *= 2;
    }
    while (A.size() < ex) {
        A.push_back(-1);
    }
    N = A.size();
    A[N - 1] = 0;
    vector<int> C, X, Y;
    C.push_back(-1);
    for (int i = 0; i < M; i++) {
        C.push_back(-1);
    }
    X.resize(N - 1);
    Y.resize(N - 1);
    for (int i = 1; i < N / 2; i++) {
        X[i - 1] = -(i * 2);
        Y[i - 1] = -(i * 2 + 1);
    }
    for (int i = N / 2; i <= N - 1; i++) {
        X[i - 1] = INF;
        Y[i - 1] = INF;
    }
    // for (int i = 0; i < C.size(); i++) {
    //     cout << C[i] << '\n';
    // }
    // cout << conn << '\n';
    ll pos = 0, cnt = 0;
    vector<bool> state(X.size());
    // for (int i = 0; i < X.size(); i++) {
    //     cout << X[i] << ' ' << Y[i] << endl;
    // }
    do {
        if (pos >= 0) {
            pos = C[pos];
        }
        else {
            if (state[-pos - 1] == 0) {
                if (X[-pos - 1] == INF) {
                    X[-pos - 1] = A[cnt++];
                }
                state[-pos - 1] = !state[-pos - 1];
                pos = X[-pos - 1];
            }
            else {
                if (Y[-pos - 1] == INF) {
                    Y[-pos - 1] = A[cnt++];
                }
                state[-pos - 1] = !state[-pos - 1];
                pos = Y[-pos - 1];
            }
        }
    } while (pos != 0);
    // for (int i = 0; i < X.size(); i++) {
    //     cout << '\t' << X[i] << ' ' << Y[i] << endl;
    // }
    if (X.size() > NN * 2) {
        exit(-1);
        // C[0] = 0;
    }
    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:19:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   19 |     while (A.size() < ex) {
      |            ~~~~~~~~~^~~~
doll.cpp:72:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   72 |     if (X.size() > NN * 2) {
      |         ~~~~~~~~~^~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 78 ms 7972 KB Output is partially correct
3 Partially correct 74 ms 8012 KB Output is partially correct
4 Partially correct 82 ms 8440 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 344 KB Output is partially correct
2 Partially correct 78 ms 7972 KB Output is partially correct
3 Partially correct 74 ms 8012 KB Output is partially correct
4 Partially correct 82 ms 8440 KB Output is partially correct
5 Partially correct 94 ms 8772 KB Output is partially correct
6 Partially correct 89 ms 8516 KB Output is partially correct
7 Partially correct 95 ms 8768 KB Output is partially correct
8 Partially correct 84 ms 8512 KB Output is partially correct
9 Partially correct 73 ms 8016 KB Output is partially correct
10 Partially correct 91 ms 8512 KB Output is partially correct
11 Partially correct 88 ms 8256 KB Output is partially correct
12 Partially correct 78 ms 8112 KB Output is partially correct
13 Partially correct 97 ms 8268 KB Output is partially correct
14 Partially correct 82 ms 8328 KB Output is partially correct
15 Partially correct 81 ms 8360 KB Output is partially correct
16 Partially correct 2 ms 604 KB Output is partially correct
17 Correct 67 ms 5448 KB Output is correct
18 Partially correct 99 ms 8112 KB Output is partially correct
19 Partially correct 84 ms 8160 KB Output is partially correct
20 Partially correct 95 ms 8372 KB Output is partially correct
21 Partially correct 94 ms 8260 KB Output is partially correct
22 Partially correct 94 ms 8452 KB Output is partially correct