Submission #794206

# Submission time Handle Problem Language Result Execution time Memory
794206 2023-07-26T10:44:42 Z alvingogo Toy Train (IOI17_train) C++14
11 / 100
2000 ms 1204 KB
#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<2*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);
			}
		}
		if(i==0){
			fill(dis.begin(),dis.end(),inf);
		}
		for(int j=0;j<n;j++){
			dis[j]=min(dis[j],dz[j]);
		}
		print(dis);
	}
	{
		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);
			}
		}
		for(int j=0;j<n;j++){
			dz[j]=min(dz[j],dis[j]);
		}
		for(int i=0;i<n;i++){
			if(dis[i]!=dz[i]){
				dis[i]=-100000*inf;
			}
		}
	}
	for(int i=0;i<2*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);
			}
		}
		for(int j=0;j<n;j++){
			dis[j]=min(dis[j],dz[j]);
		}
		print(dis);
	}
	{
		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(dz);
		for(int j=0;j<n;j++){
			dz[j]=min(dz[j],dis[j]);
		}
		for(int i=0;i<n;i++){
			ans[i]=(dis[i]>-50000*inf);
		}
	}
	
	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){
      |            ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 626 ms 684 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 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB 3rd lines differ - on the 4th token, expected: '0', found: '1'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 814 ms 880 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 Correct 833 ms 800 KB Output is correct
2 Correct 829 ms 1016 KB Output is correct
3 Correct 908 ms 1204 KB Output is correct
4 Correct 944 ms 1024 KB Output is correct
5 Correct 957 ms 1080 KB Output is correct
6 Correct 892 ms 1072 KB Output is correct
7 Correct 902 ms 1072 KB Output is correct
8 Correct 846 ms 1052 KB Output is correct
9 Correct 825 ms 1024 KB Output is correct
10 Correct 928 ms 1088 KB Output is correct
11 Correct 929 ms 1080 KB Output is correct
12 Correct 924 ms 980 KB Output is correct
13 Correct 1018 ms 980 KB Output is correct
14 Correct 860 ms 1040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1956 ms 884 KB Output is correct
2 Correct 1073 ms 852 KB Output is correct
3 Execution timed out 2065 ms 852 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 626 ms 684 KB 3rd lines differ - on the 1st token, expected: '0', found: '1'
2 Halted 0 ms 0 KB -