답안 #756344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
756344 2023-06-11T14:34:13 Z drdilyor 자동 인형 (IOI18_doll) C++17
6 / 100
92 ms 11208 KB
#include<bits/stdc++.h>
#include "doll.h"
using namespace std;
using ll = long long;

void create_circuit(int m, std::vector<int> arr) {
    vector<int> c(m+1);
    vector<int> x, y;
    auto add = [&](int a, int b){
        x.push_back(a), y.push_back(b);
        return -(int)x.size();
    };

    int n = arr.size();
    vector<vector<int>> nxt(m+1);
    arr.push_back(0);
    for (int i = 0; i < n; i++) {
        nxt[arr[i]].push_back(arr[i+1]);
    }
    for (int i = 1; i <= m; i++) {
        if (nxt[i].empty()) {
            c[i] = 0;
        } else if (nxt[i].size() == 1) {
            c[i] = nxt[i][0];
        } else if (nxt[i].size() == 2) {
            c[i] = add(nxt[i][0], nxt[i][1]);
        } else if (nxt[i].size() == 4) {
            c[i] = add(
                    add(nxt[i][0], nxt[i][1]),
                    add(nxt[i][2], nxt[i][3]));
        } else if (nxt[i].size() == 3) {
            int t1 = add(0, nxt[i][1]);
            int t2 = add(nxt[i][0], nxt[i][2]);
            int t3 = c[i] = add(t1, t2);
            end(x)[-3] = t3;
        }
    }
    c[0] = arr[0];
    answer(c, x, y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 25 ms 6312 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 38 ms 7708 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 25 ms 6312 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 38 ms 7708 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 42 ms 7240 KB Output is correct
9 Correct 49 ms 8656 KB Output is correct
10 Correct 92 ms 11208 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
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 25 ms 6312 KB Output is correct
3 Correct 19 ms 5072 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 38 ms 7708 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 42 ms 7240 KB Output is correct
9 Correct 49 ms 8656 KB Output is correct
10 Correct 92 ms 11208 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 83 ms 10920 KB Output is correct
15 Incorrect 46 ms 6060 KB wrong motion
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -