Submission #713747

#TimeUsernameProblemLanguageResultExecution timeMemory
713747PixelCat자동 인형 (IOI18_doll)C++14
6 / 100
75 ms11048 KiB
#ifdef NYAOWO
#include "grader.cpp"
#define OUT_VEC(x) { cout << #x << ":"; { for(auto &IT:x) cout << " " << IT; } cout << "\n"; }
#else
#define OUT_VEC(x)
#endif
#include "doll.h"

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sz(x) ((int)x.size())
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;

const int MAXM = 100010;

void create_circuit(int M, std::vector<int> A) {
    vector<vector<int>> adj(M + 1, vector<int>());
    vector<int> x, y;
    int n = sz(A);
    For(i, 0, n - 2) {
        adj[A[i]].eb(A[i + 1]);
    }
    adj[A.back()].eb(0);
    vector<int> ans(M + 1);
    ans[0] = A[0];
    For(i, 1, M) {
        if(sz(adj[i]) == 0) {
            ans[i] = 0;
        } else if(sz(adj[i]) == 1) {
            ans[i] = adj[i][0];
        } else {
            int tot = sz(adj[i]);
            int now = sz(x) + 1;
            ans[i] = -now;
            For(j, 0, tot - 3) {
                x.eb(adj[i][j]);
                y.eb(-(now + 1));
                now++;
            }
            x.eb(adj[i][tot - 2]);
            y.eb(adj[i][tot - 1]);
        }
    }
    OUT_VEC(ans);
    OUT_VEC(x);
    OUT_VEC(y);
    answer(ans, x, y);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...