이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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,s = 1;
vector<int> ans(m+1);
vector<int> x,y;
bool v[m+1]={};
int cnt[m+1]={};
for(auto x : a)
cnt[x]++;
ans[0] = a[0];
v[0] = true;
a.push_back(0);
for(i=0;i<n;i++){
int curr = a[i];
if(cnt[curr]==1){
ans[curr] = a[i+1];
v[curr] = true;
}
else{
if(!v[curr]){
ans[curr] = -s;
s++;
v[curr] = true;
x.push_back(a[i+1]);
y.push_back(0);
}
else{
y[-ans[curr]-1] = a[i+1];
}
}
}
for(i=1;i<=m;i++)
if(!v[i])ans[i] = i;
answer(ans,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... |