답안 #592897

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
592897 2022-07-09T19:01:14 Z keta_tsimakuridze 자동 인형 (IOI18_doll) C++17
53 / 100
147 ms 20536 KB
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
const int Nn = 2e5 + 5;
vector<int> X, Y, x[Nn];
int s = 0;
void build(vector<int> x) {
    vector<int> vl, vr;
    X.push_back(0); Y.push_back(0);
    for(int i = 0; i < x.size(); i++) {
        if(i % 2) vr.push_back(x[i]);
        else vl.push_back(x[i]);
    }
    if(vl.size() > vr.size()) {
        vr.push_back(vl.back());
        vl.back() = s;
    }

    if(vr.size() == 1) {
        X[-s - 1] = vl[0];
        Y[-s - 1] = vr[0];
        return;
    }
    int id = -s - 1;
    --s; X[id] = s;
    build(vl);

    --s; Y[id] = s;
    build(vr);
}
void create_circuit(int M, std::vector<int> A) {
    A.push_back(0);
    s = 0;
    vector<int> c(M + 1);
    vector<bool> f(M + 1);
    for(int i = (int)A.size() - 2; i >= 0; i--) {
        x[A[i]].push_back(A[i + 1]);
    }
    for(int i = 1; i <= M; i++) {
        if(x[i].size()) {
            reverse(x[i].begin(), x[i].end());
            c[i] = --s;
            build(x[i]);
        }
    }
    c[0] = A[0];
    answer(c, X, Y);
}

Compilation message

doll.cpp: In function 'void build(std::vector<int>)':
doll.cpp:10:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |     for(int i = 0; i < x.size(); i++) {
      |                    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 40 ms 10628 KB Output is correct
3 Correct 40 ms 11044 KB Output is correct
4 Correct 3 ms 4908 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 53 ms 14060 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 40 ms 10628 KB Output is correct
3 Correct 40 ms 11044 KB Output is correct
4 Correct 3 ms 4908 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 53 ms 14060 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 57 ms 11380 KB Output is correct
9 Correct 60 ms 13676 KB Output is correct
10 Correct 79 ms 14708 KB Output is correct
11 Correct 3 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 2 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4948 KB Output is correct
2 Correct 40 ms 10628 KB Output is correct
3 Correct 40 ms 11044 KB Output is correct
4 Correct 3 ms 4908 KB Output is correct
5 Correct 10 ms 6100 KB Output is correct
6 Correct 53 ms 14060 KB Output is correct
7 Correct 3 ms 4948 KB Output is correct
8 Correct 57 ms 11380 KB Output is correct
9 Correct 60 ms 13676 KB Output is correct
10 Correct 79 ms 14708 KB Output is correct
11 Correct 3 ms 4948 KB Output is correct
12 Correct 3 ms 4948 KB Output is correct
13 Correct 2 ms 4948 KB Output is correct
14 Correct 127 ms 16508 KB Output is correct
15 Correct 51 ms 10848 KB Output is correct
16 Correct 75 ms 13692 KB Output is correct
17 Correct 2 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 2 ms 4948 KB Output is correct
20 Correct 93 ms 15644 KB Output is correct
21 Correct 3 ms 4948 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 4948 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 4948 KB Output is partially correct
2 Correct 60 ms 10996 KB Output is correct
3 Partially correct 114 ms 16240 KB Output is partially correct
4 Partially correct 114 ms 17268 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 2 ms 4948 KB Output is partially correct
2 Correct 60 ms 10996 KB Output is correct
3 Partially correct 114 ms 16240 KB Output is partially correct
4 Partially correct 114 ms 17268 KB Output is partially correct
5 Partially correct 116 ms 18188 KB Output is partially correct
6 Partially correct 128 ms 19452 KB Output is partially correct
7 Partially correct 141 ms 19064 KB Output is partially correct
8 Partially correct 138 ms 20048 KB Output is partially correct
9 Partially correct 111 ms 16000 KB Output is partially correct
10 Partially correct 142 ms 19648 KB Output is partially correct
11 Partially correct 147 ms 20536 KB Output is partially correct
12 Partially correct 98 ms 14296 KB Output is partially correct
13 Partially correct 95 ms 13464 KB Output is partially correct
14 Partially correct 94 ms 13244 KB Output is partially correct
15 Partially correct 76 ms 12780 KB Output is partially correct
16 Partially correct 6 ms 5204 KB Output is partially correct
17 Partially correct 103 ms 12188 KB Output is partially correct
18 Partially correct 78 ms 13064 KB Output is partially correct
19 Partially correct 98 ms 13532 KB Output is partially correct
20 Partially correct 114 ms 16148 KB Output is partially correct
21 Partially correct 129 ms 18804 KB Output is partially correct
22 Partially correct 104 ms 15388 KB Output is partially correct