Submission #609665

# Submission time Handle Problem Language Result Execution time Memory
609665 2022-07-27T19:02:17 Z MohamedAliSaidane Mechanical Doll (IOI18_doll) C++14
6 / 100
48 ms 7844 KB
#include <bits/stdc++.h>
#include "doll.h"
    using namespace std;

    typedef long long ll;

    typedef pair<int,int> pii;
    typedef pair<ll,ll> pll;

    typedef vector<int> vi;
    typedef vector<ll> vll;
    typedef vector<pii> vpi;
    typedef vector<pll> vpl;

    #define pb push_back
    #define popb pop_back
    #define all(x) (x).begin(),(x).end()

    #define ff first
    #define ss second

    void create_circuit(int M, vi A)
    {
        int cnt[M + 1], seen[M + 1];
        memset(cnt,0 ,sizeof(cnt));
        memset(seen,0,sizeof(seen));
        int N = A.size();
        for(int i = 0 ; i < N; i ++)
            cnt[A[i]] ++;
        vi C(M + 1, 0), X, Y;
        C[0] = A[0];
        for(int i = 0 ; i < N - 1; i ++)
        {
            if(cnt[A[i]] == 1)
                C[A[i]] = A[i + 1];
            else
            {
                if(!seen[A[i]])
                {
                    X.pb(A[i + 1]);
                    Y.pb(A[i + 1]);
                    C[A[i]] = -X.size();
                }
                else
                {
                    Y[-C[A[i]] - 1] = A[i + 1];
                }
            }
            seen[A[i]] = 1;
        }
        int i = N - 1;
        if(cnt[A[i]] == 1)
            C[A[i]] = 0;
        else
        {
            Y[-C[A[i]] - 1] = 0;
        }
        answer(C, X, Y);
    }
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 16 ms 2748 KB Output is correct
3 Correct 12 ms 2004 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 8 ms 2260 KB Output is correct
6 Correct 19 ms 3024 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 16 ms 2748 KB Output is correct
3 Correct 12 ms 2004 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 8 ms 2260 KB Output is correct
6 Correct 19 ms 3024 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 35 ms 4264 KB Output is correct
9 Correct 33 ms 5280 KB Output is correct
10 Correct 48 ms 7844 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 16 ms 2748 KB Output is correct
3 Correct 12 ms 2004 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 8 ms 2260 KB Output is correct
6 Correct 19 ms 3024 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 35 ms 4264 KB Output is correct
9 Correct 33 ms 5280 KB Output is correct
10 Correct 48 ms 7844 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Incorrect 43 ms 6416 KB wrong motion
15 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB wrong motion
2 Halted 0 ms 0 KB -