Submission #756345

# Submission time Handle Problem Language Result Execution time Memory
756345 2023-06-11T14:34:56 Z drdilyor Mechanical Doll (IOI18_doll) C++17
16 / 100
106 ms 11556 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][2]),
                    add(nxt[i][1], 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);
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 6356 KB Output is correct
3 Correct 19 ms 5168 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 37 ms 7628 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 6356 KB Output is correct
3 Correct 19 ms 5168 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 37 ms 7628 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 50 ms 7220 KB Output is correct
9 Correct 49 ms 8628 KB Output is correct
10 Correct 75 ms 11292 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 31 ms 6356 KB Output is correct
3 Correct 19 ms 5168 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 10 ms 3796 KB Output is correct
6 Correct 37 ms 7628 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 50 ms 7220 KB Output is correct
9 Correct 49 ms 8628 KB Output is correct
10 Correct 75 ms 11292 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 106 ms 11020 KB Output is correct
15 Correct 39 ms 5968 KB Output is correct
16 Correct 68 ms 9576 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 77 ms 11556 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -