Submission #75298

#TimeUsernameProblemLanguageResultExecution timeMemory
75298KieranHorganMechanical Doll (IOI18_doll)C++17
2 / 100
66 ms10436 KiB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> A, X, Y, C;
int dep[200];
int nextSwitch = -1;
vector<int> AdjList[200005];

void buildTree(int curSwitch, int curTrigger) {

}

void create_circuit(int M, vector<int> A_) {
  A = A_;
  AdjList[0].push_back(A[0]);
  for(int i = 0; i+1 < A.size(); i++) {
    AdjList[A[i]].push_back(A[i+1]);
  }
  AdjList[A.back()].push_back(0);

  C.assign(M+1, 0);
  for(int i = 0; i <= M; i++) {
    if(AdjList[i].size() == 0) {
    } else if(AdjList[i].size() == 1) {
      C[i] = AdjList[i][0];
    } else {
      C[i] = nextSwitch--;
      buildTree(C[i], i);
    }
  }

  // cerr << nextSwitch << endl;
  // for(int i = 1; dep[i]; i++)
    // cerr << i << ": " << dep[i] << endl;
  // 
  // cerr << N << " " << X.size() << endl;


  answer(C, X, Y);
}

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:17:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |   for(int i = 0; i+1 < A.size(); i++) {
      |                  ~~~~^~~~~~~~~~
#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...