# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
789659 | esomer | Toy Train (IOI17_train) | C++17 | 476 ms | 1400 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "train.h"
using namespace std;
typedef long long ll;
void process(vector<int>& A, vector<int>& R, vector<int>& U, vector<int>& V, vector<bool>& forced, vector<int>& out, vector<vector<int>>& radj){
int n = (int)A.size();
int m = (int)U.size();
queue<int> q;
for(int i = 0; i < n; i++){
if(out[i] == 0 || R[i] == 1){
forced[i] = 0;
q.push(i);
}
}
vector<int> org = out;
while(!q.empty()){
int x = q.front(); q.pop();
for(int node : radj[x]){
out[node]--;
if(forced[node] == 0) continue;
if(out[node] == 0) {q.push(node); forced[node] = 0;}
else if(A[node] == 1){
forced[node] = 0;
q.push(node);
}
}
}
Compilation message (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... |