Submission #1013218

# Submission time Handle Problem Language Result Execution time Memory
1013218 2024-07-03T10:09:20 Z c2zi6 Mechanical Doll (IOI18_doll) C++14
6 / 100
40 ms 7888 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "doll.h"

void create_circuit(int M, VI A) {
    VI C, X, Y;
    C = VI(M+1);

    VI cnt(M+1);
    for (int x : A) cnt[x]++;

    VI sw(M+1, -1);
    int u = 0;
    for (int v : A) {
        if (cnt[u] == 2) {
            if (sw[u] == -1) {
                sw[u] = X.size();
                C[u] = -(sw[u]+1);
                X.pb(0);
                Y.pb(0);
                X[sw[u]] = v;

            } else {
                Y[sw[u]] = v;
            }
        } else {
            C[u] = v;
        }

        u = v;
    }

    /*rep(u, C.size()) cout << u << " -> " << C[u] << endl;*/
    /*rep(u, X.size()) cout << u << " -> " << X[u] << "/" << Y[u] << endl;*/

    answer(C, X, Y);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 11 ms 2908 KB Output is correct
3 Correct 8 ms 2136 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 2396 KB Output is correct
6 Correct 12 ms 3164 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 11 ms 2908 KB Output is correct
3 Correct 8 ms 2136 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 2396 KB Output is correct
6 Correct 12 ms 3164 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 21 ms 4516 KB Output is correct
9 Correct 40 ms 5424 KB Output is correct
10 Correct 32 ms 7888 KB Output is correct
11 Correct 0 ms 440 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 11 ms 2908 KB Output is correct
3 Correct 8 ms 2136 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 5 ms 2396 KB Output is correct
6 Correct 12 ms 3164 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 21 ms 4516 KB Output is correct
9 Correct 40 ms 5424 KB Output is correct
10 Correct 32 ms 7888 KB Output is correct
11 Correct 0 ms 440 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Incorrect 20 ms 4668 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -