제출 #139239

#제출 시각아이디문제언어결과실행 시간메모리
139239qrno자동 인형 (IOI18_doll)C++14
6 / 100
67 ms7316 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 100100; const int INF = 123456; int app[MAXN]; bool secondTime[MAXN]; void printAns(vector<int> C, vector<int> X, vector<int> Y) { cout << "C: "; for (int x : C) cout << x << " "; cout << endl; cout << "(X, Y): "; for (int i = 0; i < (int)X.size(); i++) { cout << "(" << X[i] << ", " << Y[i] << ") "; } cout << endl; } void create_circuit(int M, std::vector<int> A) { A.push_back(0); int reqTrig = A.size(); memset(app, 0, sizeof(app)); memset(secondTime, false, sizeof(secondTime)); vector<int> C(M + 1, INF); vector<int> X, Y; for (int x : A) app[x]++; int sCount = -1; C[0] = A[0]; for (int i = 0; i < reqTrig-1; i++) { int now = A[i]; int nex = A[i+1]; if (secondTime[now]) { Y[-C[now]-1] = nex; } else if (app[A[i]] == 2) { C[now] = sCount; sCount -= 1; X.push_back(nex); Y.push_back(-1); } else { C[now] = nex; } secondTime[now] = true; } for (int i = 1; i <= M; i++) { if (C[i] == INF) C[i] = 0; } 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...