# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1033649 |
2024-07-25T04:09:05 Z |
vjudge1 |
Toy Train (IOI17_train) |
C++17 |
|
11 ms |
6576 KB |
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100100],radj[100100];
stack<int>stk;
int onstk[100100],id[100100],low[100100],cmp[100100],sz[100100],CC,slf[100100];
void tarjan(int n){
onstk[n]=1;
stk.push(n);
id[n]=low[n]=++CC;
for(auto i:adj[n]){
if(!id[i])
tarjan(i);
if(onstk[i])
low[n]=min(low[n],low[i]);
}
if(low[n]==id[n]){
while(onstk[n]){
int x=stk.top();
stk.pop();cmp[x]=n;
onstk[x]=0,sz[n]++;
}
}
}
vector<int>ans;
void yes(int n){
if(ans[n])return;
ans[n]=1;
for(auto x:radj[n])
yes(x);
}
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n=a.size(),m=u.size();
ans.resize(n,0);
for(int i=0;i<m;i++)slf[u[i]]|=v[i]==u[i],
adj[u[i]].push_back(v[i]),
radj[v[i]].push_back(u[i]);
for(int i=0;i<n;i++)
if(!id[i])tarjan(i);
for(int i=0;i<n;i++)
if((sz[cmp[i]]>1||slf[i])&&r[i])
yes(i);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
6424 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
5212 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
6492 KB |
Output is correct |
2 |
Correct |
6 ms |
6492 KB |
Output is correct |
3 |
Correct |
6 ms |
6488 KB |
Output is correct |
4 |
Correct |
6 ms |
6576 KB |
Output is correct |
5 |
Correct |
10 ms |
6492 KB |
Output is correct |
6 |
Correct |
6 ms |
6236 KB |
Output is correct |
7 |
Correct |
6 ms |
6236 KB |
Output is correct |
8 |
Correct |
6 ms |
6492 KB |
Output is correct |
9 |
Correct |
6 ms |
6232 KB |
Output is correct |
10 |
Correct |
6 ms |
6232 KB |
Output is correct |
11 |
Correct |
10 ms |
6236 KB |
Output is correct |
12 |
Correct |
6 ms |
6236 KB |
Output is correct |
13 |
Correct |
7 ms |
6492 KB |
Output is correct |
14 |
Correct |
11 ms |
6492 KB |
Output is correct |
15 |
Correct |
6 ms |
6492 KB |
Output is correct |
16 |
Correct |
7 ms |
6488 KB |
Output is correct |
17 |
Correct |
11 ms |
6488 KB |
Output is correct |
18 |
Correct |
4 ms |
5980 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
6236 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
6316 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
6424 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |