제출 #571069

#제출 시각아이디문제언어결과실행 시간메모리
571069elazarkorenMechanical Doll (IOI18_doll)C++17
6 / 100
68 ms13808 KiB
#include "doll.h"
#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MAX_M = 1e5 + 5;

vi graph[MAX_M];

void create_circuit(int m, std::vector<int> a) {
    int n = a.size();
    a.push_back(0);
    graph[0].push_back(a[0]);
    for (int i = 0; i < n; i++) {
        graph[a[i]].push_back(a[i + 1]);
    }
    vi c(m + 1), x, y;
    for (int i = 0; i <= m; i++) {
        if (graph[i].size() == 1) {
            c[i] = graph[i][0];
        } else if (!graph[i].empty()) {
            x.push_back(graph[i][0]), y.push_back(graph[i][1]);
            c[i] = -int(x.size());
        }
    }
    answer(c, 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...