Submission #612083

# Submission time Handle Problem Language Result Execution time Memory
612083 2022-07-29T10:41:10 Z Jomnoi Mechanical Doll (IOI18_doll) C++17
6 / 100
161 ms 28180 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 4 ms 7252 KB Output is correct
2 Correct 38 ms 14160 KB Output is correct
3 Correct 41 ms 13892 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 11 ms 8404 KB Output is correct
6 Correct 66 ms 17256 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 38 ms 14160 KB Output is correct
3 Correct 41 ms 13892 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 11 ms 8404 KB Output is correct
6 Correct 66 ms 17256 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
8 Correct 93 ms 19632 KB Output is correct
9 Correct 89 ms 19972 KB Output is correct
10 Correct 135 ms 26404 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 4 ms 7252 KB Output is correct
13 Correct 4 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 7252 KB Output is correct
2 Correct 38 ms 14160 KB Output is correct
3 Correct 41 ms 13892 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 11 ms 8404 KB Output is correct
6 Correct 66 ms 17256 KB Output is correct
7 Correct 4 ms 7252 KB Output is correct
8 Correct 93 ms 19632 KB Output is correct
9 Correct 89 ms 19972 KB Output is correct
10 Correct 135 ms 26404 KB Output is correct
11 Correct 4 ms 7252 KB Output is correct
12 Correct 4 ms 7252 KB Output is correct
13 Correct 4 ms 7252 KB Output is correct
14 Incorrect 161 ms 28180 KB wrong serial number
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 7312 KB wrong serial number
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 7252 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 7252 KB wrong motion
2 Halted 0 ms 0 KB -