| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1245677 | Gabriel | Mechanical Doll (IOI18_doll) | C++17 | 42 ms | 11192 KiB |
#include "doll.h"
#include "bits/stdc++.h"
using namespace std;
void create_circuit(int m, vector<int> a){
int n = a.size();
vector< vector<int> > Grafo(m + 1);
vector<int> c(m + 1);
for(int i = 1; i < n; i++){
Grafo[a[i - 1]].push_back(a[i]);
}
Grafo[a.back()].push_back(0);
c[0] = a[0];
vector<int> x, y;
int Interruptor = -1;
for(int i = 1; i < m + 1; i++){
if(Grafo[i].empty()) c[i] = 0;
if(Grafo[i].size() == 1){
x.push_back(Interruptor);
y.push_back(Grafo[i][0]);
c[i] = Interruptor;
Interruptor--;
}
if(Grafo[i].size() == 2){
x.push_back(Grafo[i][0]);
y.push_back(Grafo[i][1]);
c[i] = Interruptor;
Interruptor--;
}
}
answer(c, x, y);
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
