Submission #789659

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7896592023-07-21 16:27:39esomerToy Train (IOI17_train)C++17
100 / 100
476 ms1400 KiB
#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);
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

train.cpp: In function 'void process(std::vector<int>&, std::vector<int>&, std::vector<int>&, std::vector<int>&, std::vector<bool>&, std::vector<int>&, std::vector<std::vector<int> >&)':
train.cpp:10:6: warning: unused variable 'm' [-Wunused-variable]
   10 |  int m = (int)U.size();
      |      ^
#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...