Submission #612075

# Submission time Handle Problem Language Result Execution time Memory
612075 2022-07-29T10:37:40 Z Jomnoi Mechanical Doll (IOI18_doll) C++17
6 / 100
163 ms 28264 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) {
                int now = S;
                S += 2;
                X.push_back(-now - 1);
                Y.push_back(-now - 2);
                X.push_back(nxt[a][0]);
                Y.push_back(-now);
                X.push_back(nxt[a][1]);
                Y.push_back(nxt[a][2]);
            }
            else if(nxt[a].size() == 4) {
                int now = S;
                S += 2;
                X.push_back(-now - 1);
                Y.push_back(-now - 2);
                X.push_back(nxt[a][0]);
                X.push_back(nxt[a][1]);
                Y.push_back(nxt[a][2]);
                Y.push_back(nxt[a][3]);
            }
        }
    }
    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7252 KB Output is correct
2 Correct 43 ms 14124 KB Output is correct
3 Correct 31 ms 13824 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 15 ms 8532 KB Output is correct
6 Correct 73 ms 17216 KB Output is correct
7 Correct 3 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7252 KB Output is correct
2 Correct 43 ms 14124 KB Output is correct
3 Correct 31 ms 13824 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 15 ms 8532 KB Output is correct
6 Correct 73 ms 17216 KB Output is correct
7 Correct 3 ms 7252 KB Output is correct
8 Correct 84 ms 19652 KB Output is correct
9 Correct 86 ms 20052 KB Output is correct
10 Correct 148 ms 26516 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 5 ms 7272 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7252 KB Output is correct
2 Correct 43 ms 14124 KB Output is correct
3 Correct 31 ms 13824 KB Output is correct
4 Correct 4 ms 7252 KB Output is correct
5 Correct 15 ms 8532 KB Output is correct
6 Correct 73 ms 17216 KB Output is correct
7 Correct 3 ms 7252 KB Output is correct
8 Correct 84 ms 19652 KB Output is correct
9 Correct 86 ms 20052 KB Output is correct
10 Correct 148 ms 26516 KB Output is correct
11 Correct 4 ms 7380 KB Output is correct
12 Correct 5 ms 7272 KB Output is correct
13 Correct 5 ms 7252 KB Output is correct
14 Incorrect 163 ms 28264 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 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 -