Submission #601481

#TimeUsernameProblemLanguageResultExecution timeMemory
601481jack715Mechanical Doll (IOI18_doll)C++14
6 / 100
57 ms7944 KiB
#include "doll.h"
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pp pop_back
#define mp make_pair
#define bb back
#define ff first
#define ss second

using namespace std;


void create_circuit(int m, vector<int> a) {
  int ball = 0;
  vector<int> C(m + 1, 0);
  vector<int> X, Y;

  a.push_back(0);
  for (int next : a) {
    if (C[ball] == next) {
      ball = next;
      continue;
    }
    if (C[ball] == 0) {
      C[ball] = next;      
    } else {
      X.push_back(C[ball]);
      Y.push_back(next);
      C[ball] = -X.size();
    }
    ball = next;
  }

  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...