Submission #138240

# Submission time Handle Problem Language Result Execution time Memory
138240 2019-07-29T16:04:16 Z rajarshi_basu Toy Train (IOI17_train) C++14
5 / 100
9 ms 892 KB
#include <bits/stdc++.h>

#define FOR(i,n) for(int i=0;i<n;i++)
#define FORE(i,a,b) for(int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
#define vi vector<int>
#define ff first
#define ss second
#define vv vector
#define ii pair<int,int>

using namespace std;

const int MAXN = 5001;

bool self[MAXN];
bool nxt[MAXN];

vi who_wins(vi a,vi r,vi u,vi v){
	int m = u.size();
	int n = a.size();
	FOR(i,m){
		if(u[i] == v[i])self[u[i]] = 1;
		else nxt[u[i]] = 1;
	}
	vi arr(n);
	for(int i = n-1;i >= 0;i--){
		if(a[i] == 0 and r[i] == 0){
			if(self[i])arr[i] = 0;
			else arr[i] = arr[i+1];
		}else if(a[i] == 0 and r[i] == 1){
			if(nxt[i])arr[i] = arr[i+1];
			else arr[i] = 1;
		}else if(a[i] == 1 and r[i] == 0){
			if(nxt[i])arr[i] = arr[i+1];
			else arr[i] = 0;
		}else{
			if(self[i])arr[i] = 1;
			else arr[i] = arr[i+1];
		}
	}
	return arr;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 632 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 6 ms 632 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 5 ms 632 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 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 8 ms 760 KB Output is correct
2 Correct 8 ms 888 KB Output is correct
3 Correct 8 ms 892 KB Output is correct
4 Incorrect 8 ms 888 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 8 ms 632 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 9 ms 760 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 5 ms 504 KB Output is correct
2 Correct 5 ms 632 KB Output is correct
3 Correct 6 ms 632 KB Output is correct
4 Correct 5 ms 632 KB Output is correct
5 Correct 5 ms 632 KB Output is correct
6 Correct 5 ms 632 KB Output is correct
7 Correct 6 ms 632 KB Output is correct
8 Correct 5 ms 632 KB Output is correct
9 Correct 5 ms 632 KB Output is correct
10 Correct 5 ms 632 KB Output is correct
11 Correct 5 ms 632 KB Output is correct
12 Incorrect 2 ms 376 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -