Submission #295990

# Submission time Handle Problem Language Result Execution time Memory
295990 2020-09-10T07:00:32 Z Autoratch Mechanical Doll (IOI18_doll) C++14
16 / 100
155 ms 16224 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5 + 1;

int sw;
vector<int> nxt[N];
int x[N],y[N];

void create_circuit(int m,vector<int> a) 
{
    int n = a.size();
    vector<int> c(m+1);
    a.push_back(0);
    for(int i = 0;i < n;i++) nxt[a[i]].push_back(a[i+1]);
    c[0] = a[0];
    for(int i = 1;i <= m;i++) if(!nxt[i].empty())
    {
        if(nxt[i].size()==1) c[i] = nxt[i][0];
        else if(nxt[i].size()==2) 
        {
            c[i] = ++sw;
            c[i] = -c[i];
            x[sw] = nxt[i][0];
            y[sw] = nxt[i][1];
        }
        else if(nxt[i].size()==3)
        {
            int s1 = ++sw,s2 = ++sw,s3 = ++sw;
            c[i] = -s1;
            x[s1] = -s2;
            y[s1] = -s3;
            x[s2] = -s1;
            y[s2] = nxt[i][1];
            x[s3] = nxt[i][0];
            y[s3] = nxt[i][2];
        }
        else 
        {
            int s1 = ++sw,s2 = ++sw,s3 = ++sw;
            c[i] = -s1;
            x[s1] = -s2;
            y[s1] = -s3;
            x[s2] = nxt[i][0];
            y[s2] = nxt[i][2];
            x[s3] = nxt[i][1];
            y[s3] = nxt[i][3];
        }
    }
    vector<int> sx,sy;
    for(int i = 1;i <= sw;i++) sx.push_back(x[i]),sy.push_back(y[i]);
    answer(c,sx,sy);
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 43 ms 8712 KB Output is correct
3 Correct 34 ms 8256 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 16 ms 6092 KB Output is correct
6 Correct 42 ms 10052 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 43 ms 8712 KB Output is correct
3 Correct 34 ms 8256 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 16 ms 6092 KB Output is correct
6 Correct 42 ms 10052 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 83 ms 11380 KB Output is correct
9 Correct 58 ms 11516 KB Output is correct
10 Correct 106 ms 15136 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 5 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 4940 KB Output is correct
2 Correct 43 ms 8712 KB Output is correct
3 Correct 34 ms 8256 KB Output is correct
4 Correct 5 ms 4940 KB Output is correct
5 Correct 16 ms 6092 KB Output is correct
6 Correct 42 ms 10052 KB Output is correct
7 Correct 4 ms 4940 KB Output is correct
8 Correct 83 ms 11380 KB Output is correct
9 Correct 58 ms 11516 KB Output is correct
10 Correct 106 ms 15136 KB Output is correct
11 Correct 3 ms 4940 KB Output is correct
12 Correct 3 ms 4940 KB Output is correct
13 Correct 5 ms 4940 KB Output is correct
14 Correct 155 ms 16224 KB Output is correct
15 Correct 70 ms 11448 KB Output is correct
16 Correct 89 ms 13420 KB Output is correct
17 Correct 4 ms 4940 KB Output is correct
18 Correct 5 ms 4940 KB Output is correct
19 Correct 5 ms 4876 KB Output is correct
20 Correct 102 ms 14868 KB Output is correct
21 Correct 4 ms 4984 KB Output is correct
22 Correct 5 ms 4940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 4940 KB wrong motion
2 Halted 0 ms 0 KB -