Submission #612086

# Submission time Handle Problem Language Result Execution time Memory
612086 2022-07-29T10:41:57 Z Jomnoi Mechanical Doll (IOI18_doll) C++17
6 / 100
139 ms 28196 KB
#include <bits/stdc++.h>
#include "doll.h"
using namespace std;

const int MAX_M = 1e5 + 5;

int N, M, S;
set <int> keepnxt[MAX_M];
vector <int> nxt[MAX_M];
vector<int> C, X, Y;

void create_circuit(int m, vector <int> A) {
    N = A.size(), M = m;
    C.resize(M + 1);

    A.push_back(0);
    for(int i = 0; i < N; i++) {
        if(keepnxt[A[i]].count(A[i + 1])) {
            continue;
        }

        keepnxt[A[i]].insert(A[i + 1]);
        nxt[A[i]].push_back(A[i + 1]);
    }

    C[0] = A[0];
    for(int a = 1; a <= M; a++) {
        if(nxt[a].empty()) {
            continue;
        }
        else if(nxt[a].size() == 1) {
            C[a] = nxt[a][0];
        }
        else {
            S++;
            C[a] = -S;
            if(nxt[a].size() == 2) {
                X.push_back(nxt[a][0]);
                Y.push_back(nxt[a][1]);
            }
            else if(nxt[a].size() == 3) {
                X.push_back(-(++S));
                Y.push_back(-(++S));

                X.push_back(nxt[a][0]);
                Y.push_back(-(S - 2));

                X.push_back(nxt[a][1]);
                Y.push_back(nxt[a][2]);
            }
            else if(nxt[a].size() == 4) {
                X.push_back(-(++S));
                Y.push_back(-(++S));

                X.push_back(nxt[a][0]);
                Y.push_back(nxt[a][2]);

                X.push_back(nxt[a][1]);
                Y.push_back(nxt[a][3]);
            }
        }
    }

    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7316 KB Output is correct
2 Correct 43 ms 14156 KB Output is correct
3 Correct 31 ms 13764 KB Output is correct
4 Correct 4 ms 7264 KB Output is correct
5 Correct 12 ms 8532 KB Output is correct
6 Correct 56 ms 17212 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7316 KB Output is correct
2 Correct 43 ms 14156 KB Output is correct
3 Correct 31 ms 13764 KB Output is correct
4 Correct 4 ms 7264 KB Output is correct
5 Correct 12 ms 8532 KB Output is correct
6 Correct 56 ms 17212 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
8 Correct 83 ms 19620 KB Output is correct
9 Correct 97 ms 20024 KB Output is correct
10 Correct 131 ms 26412 KB Output is correct
11 Correct 4 ms 7348 KB Output is correct
12 Correct 3 ms 7252 KB Output is correct
13 Correct 3 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 7316 KB Output is correct
2 Correct 43 ms 14156 KB Output is correct
3 Correct 31 ms 13764 KB Output is correct
4 Correct 4 ms 7264 KB Output is correct
5 Correct 12 ms 8532 KB Output is correct
6 Correct 56 ms 17212 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
8 Correct 83 ms 19620 KB Output is correct
9 Correct 97 ms 20024 KB Output is correct
10 Correct 131 ms 26412 KB Output is correct
11 Correct 4 ms 7348 KB Output is correct
12 Correct 3 ms 7252 KB Output is correct
13 Correct 3 ms 7252 KB Output is correct
14 Incorrect 139 ms 28196 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 7252 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 7252 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 7252 KB wrong motion
2 Halted 0 ms 0 KB -