답안 #286138

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286138 2020-08-30T07:14:40 Z NONAME 자동 인형 (IOI18_doll) C++14
16 / 100
140 ms 12584 KB
#include "doll.h"

const int MAX_M = (int)(1e5 + 500);

std::vector <int> res, X, Y;
std::vector <int> g[MAX_M];

void create_circuit (int m, std::vector <int> a) {
    int n = (int)(a.size());
    
    res.resize(m + 1);
    res[0] = a[0];
    
    for (int i = 0; i < n; ++i)
        g[a[i]].push_back((i + 1 == n) ? 0 : a[i + 1]);

    int cur = -1;
    for (int i = 1; i <= m; ++i) {
        if ((int)(g[i].size()) == 1)
            res[i] = g[i][0];

        if ((int)(g[i].size()) == 2) {
            res[i] = cur;
            X.push_back(g[i][0]);
            Y.push_back(g[i][1]);
            --cur;
        }

        if ((int)(g[i].size()) == 3) {
            res[i] = cur;
            X.push_back(cur - 1);
            Y.push_back(cur - 2);
            X.push_back(cur);
            Y.push_back(g[i][1]);
            X.push_back(g[i][0]);
            Y.push_back(g[i][2]);
            cur -= 3;
        }

        if ((int)(g[i].size()) == 4) {
            res[i] = cur;
            X.push_back(cur - 1);
            Y.push_back(cur - 2);
            X.push_back(g[i][0]);
            Y.push_back(g[i][2]);
            X.push_back(g[i][1]);
            Y.push_back(g[i][3]);
            cur -= 3;
        }
    }
    
    answer(res, X, Y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 55 ms 6344 KB Output is correct
3 Correct 31 ms 5984 KB Output is correct
4 Correct 3 ms 2636 KB Output is correct
5 Correct 14 ms 3788 KB Output is correct
6 Correct 46 ms 7620 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 55 ms 6344 KB Output is correct
3 Correct 31 ms 5984 KB Output is correct
4 Correct 3 ms 2636 KB Output is correct
5 Correct 14 ms 3788 KB Output is correct
6 Correct 46 ms 7620 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
8 Correct 59 ms 8124 KB Output is correct
9 Correct 61 ms 8684 KB Output is correct
10 Correct 140 ms 11060 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 2636 KB Output is correct
2 Correct 55 ms 6344 KB Output is correct
3 Correct 31 ms 5984 KB Output is correct
4 Correct 3 ms 2636 KB Output is correct
5 Correct 14 ms 3788 KB Output is correct
6 Correct 46 ms 7620 KB Output is correct
7 Correct 3 ms 2636 KB Output is correct
8 Correct 59 ms 8124 KB Output is correct
9 Correct 61 ms 8684 KB Output is correct
10 Correct 140 ms 11060 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 3 ms 2636 KB Output is correct
14 Correct 111 ms 12584 KB Output is correct
15 Correct 57 ms 7480 KB Output is correct
16 Correct 91 ms 10212 KB Output is correct
17 Correct 3 ms 2720 KB Output is correct
18 Correct 3 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 111 ms 11580 KB Output is correct
21 Correct 3 ms 2636 KB Output is correct
22 Correct 3 ms 2636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 2640 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2636 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 2636 KB wrong motion
2 Halted 0 ms 0 KB -