#include "train.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
typedef long long ll;
const ll inf=1e9;
void print(auto a){
return;
for(auto h:a){
cerr << h << " ";
}
cerr << "\n";
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n=a.size(),m=u.size();
vector<int> ans(n);
vector<ll> dis(n),val(n);
vector<ll> it(n);
for(int i=0;i<n;i++){
if(r[i]==0){
val[i]=-1;
}
else{
val[i]=inf;
}
}
for(int i=0;i<=n;i++){
if(a[i]==0){
it[i]=100000*inf;
}
else{
it[i]=-100000*inf;
}
}
for(int i=0;i<n;i++){
auto dz=it;
for(int j=0;j<m;j++){
ll p=dis[v[j]]+val[v[j]];
if(a[u[j]]==1){
dz[u[j]]=max(dz[u[j]],p);
}
else{
dz[u[j]]=min(dz[u[j]],p);
}
}
print(dis);
dis=dz;
}
auto dz=it;
for(int j=0;j<m;j++){
ll p=dis[v[j]]+val[v[j]];
if(a[u[j]]==1){
dz[u[j]]=max(dz[u[j]],p);
}
else{
dz[u[j]]=min(dz[u[j]],p);
}
}
print(dis);
print(dz);
for(int i=0;i<n;i++){
ans[i]=(dis[i]>=0);
}
return ans;
}
Compilation message
train.cpp:12:12: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
12 | void print(auto a){
| ^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
85 ms |
596 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
219 ms |
884 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
179 ms |
808 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
386 ms |
884 KB |
Output is correct |
2 |
Correct |
273 ms |
1108 KB |
Output is correct |
3 |
Correct |
591 ms |
1108 KB |
Output is correct |
4 |
Correct |
475 ms |
1028 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
84 ms |
756 KB |
Output is correct |
7 |
Correct |
44 ms |
720 KB |
Output is correct |
8 |
Incorrect |
57 ms |
760 KB |
3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
85 ms |
596 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |