# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
795421 | fatemetmhr | 장난감 기차 (IOI17_train) | C++17 | 19 ms | 24916 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// ~ Be Name Khoda ~ //
#include "train.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn = 1e6 + 10;
const int maxn5 = 5e5 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const ll inf = 1e18;
int cnt[maxn5], q[maxn5];
vector <int> adj[maxn5], jda[maxn5];
bool mark[maxn5], good[maxn5];
std::vector<int> who_wins(std::vector<int> a, std::vector<int> ch, std::vector<int> u, std::vector<int> v) {
int n = a.size(), m = u.size();
int x;
for(int i = 0; i < n; i++) if(ch[i])
x = i;
for(int i = 0; i < m; i++){
adj[u[i]].pb(v[i]);
jda[v[i]].pb(u[i]);
cnt[u[i]]++;
}
int l = 0, r = 0;
for(auto u : jda[x]){
if(a[u]){
q[r++] = u;
good[u] = true;
}
else if(cnt[u] > 1)
cnt[u]--;
else{
q[r++] = u;
good[u] = true;
}
}
while(l < r){
int v = q[l++];
for(auto u : jda[v]) if(!good[u]){
if(a[u]){
q[r++] = u;
good[u] = true;
}
else if(cnt[u] > 1)
cnt[u]--;
else{
q[r++] = u;
good[u] = true;
}
}
}
vector <int> ret;
for(int i = 0; i < n; i++)
ret.pb(good[x] && good[i]);
return ret;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |