Submission #617891

# Submission time Handle Problem Language Result Execution time Memory
617891 2022-08-01T16:25:50 Z chirathnirodha Toy Train (IOI17_train) C++17
5 / 100
14 ms 1236 KB
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define PB push_back
#define MP make_pair
#define F first
#define S second

int n,m;
vector<int> ed[5000];
bool own[5000];
bool charge[5000];
bool self[5000];
vector<int> SUB_1() {
	vector<int> ans(n);
	for(int i=0;i<n;i++){
		for(int j=i;j<n;j++){
			if(self[j]==true && ed[j].size()==1){
				if(charge[j]==true)ans[i]=1;
				else ans[i]=0;
				break;
			}
			if(own[j]==true && charge[j]==true && self[j]==true){ans[i]=1;break;}
			if(own[j]==false && charge[j]==false && self[j]==true){ans[i]=0;break;}
		}
	}
	return ans;
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
	n=a.size();m=u.size();
	memset(self,false,sizeof(self));
	for(int i=0;i<m;i++){
		ed[u[i]].PB(v[i]);
		if(u[i]==v[i])self[u[i]]=true;
	}
	for(int i=0;i<n;i++){own[i]=a[i];charge[i]=r[i];}
	return SUB_1();
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 852 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 4 ms 856 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 3 ms 852 KB Output is correct
6 Correct 4 ms 784 KB Output is correct
7 Correct 5 ms 852 KB Output is correct
8 Correct 4 ms 812 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 3 ms 852 KB Output is correct
11 Correct 4 ms 820 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 11 ms 1236 KB Output is correct
2 Correct 11 ms 1204 KB Output is correct
3 Correct 11 ms 1236 KB Output is correct
4 Incorrect 13 ms 1236 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1068 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1200 KB 3rd lines differ - on the 1st token, expected: '1', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 852 KB Output is correct
2 Correct 4 ms 852 KB Output is correct
3 Correct 4 ms 856 KB Output is correct
4 Correct 4 ms 724 KB Output is correct
5 Correct 3 ms 852 KB Output is correct
6 Correct 4 ms 784 KB Output is correct
7 Correct 5 ms 852 KB Output is correct
8 Correct 4 ms 812 KB Output is correct
9 Correct 4 ms 724 KB Output is correct
10 Correct 3 ms 852 KB Output is correct
11 Correct 4 ms 820 KB Output is correct
12 Incorrect 1 ms 340 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -