Submission #299676

#TimeUsernameProblemLanguageResultExecution timeMemory
299676Dremix10Mechanical Doll (IOI18_doll)C++17
2 / 100
38 ms2764 KiB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
#define F first
#define S second
#define endl '\n'
#define all(x) (x).begin(),(x).end()
const ll INF = 1e18;
const int N = 3e5+1;


void create_circuit(int m, vector<int> a) {
    int n = a.size();
    /// each trigger can only go to one place
    /// so in the case of {1,2,1} 1 can't go to 2 because
    /// the second time we get to 1 we will go to 2 which
    /// shouldn't happen

    int i;
    vector<int> ans(m+1,-1);
    int prev = 0;
    for(i=0;i<n;i++){
        ans[prev] = a[i];
        prev = a[i];
    }
    ans[prev] = 0;
    for(i=0;i<=m;i++)
        if(ans[i]==-1)ans[i] = i;
    answer(ans,{},{});
}
#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...