Submission #284008

#TimeUsernameProblemLanguageResultExecution timeMemory
284008milleniumEeeeMechanical Doll (IOI18_doll)C++14
6 / 100
92 ms10120 KiB
#include "doll.h"
#include <bits/stdc++.h>
#define fr first
#define sc second
#define pii pair<int, int>
using namespace std;
 
int N, M, S;
vector <int> A, C, X, Y;
 
// A - sequance 
// C - edges of triggers
// X/Y - edges of switches
// M - triggers vertexes
 
void solve() {
  vector <vector<int>> after(M + 1);
  vector <int> cnt(M + 1, 0);
  A.push_back(0);
  for (int i = 1; i <= N; i++) {
    after[A[i]].push_back(A[i + 1]);
    cnt[A[i]]++;
  }
  int id = -1;
  for (int i = 1; i <= M; i++) {
    if (cnt[i] == 0) {
      continue;
    }
    if (cnt[i] == 1) {
      C[i] = after[i][0];
    }
    if (cnt[i] == 2) {
      C[i] = id--;
      X.push_back(after[i][0]);
      Y.push_back(after[i][1]);
    }
    if (cnt[i] == 3) {
      
    }
    if (cnt[i] == 4) {
      
    }
  }
}

//3 6
//1 3 2 2 1 3

void create_circuit(int MM, vector<int> AA) {
  M = MM;
  N = AA.size();
  A.resize(N + 1);
  A[0] = 0;
  for (int i = 0; i < N; i++) {
    A[i + 1] = AA[i];
  }
  C.resize(M + 1);
  solve();
  C[0] = A[1];
  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...