Submission #1025822

# Submission time Handle Problem Language Result Execution time Memory
1025822 2024-07-17T10:27:31 Z AmirAli_H1 Toy Train (IOI17_train) C++17
5 / 100
5 ms 860 KB
// In the name of Allah

#include <bits/stdc++.h>
#include "train.h"
using namespace std;

typedef		long long int			ll;
typedef		long double				ld;
typedef		pair<int, int>			pii;
typedef		pair<ll, ll>			pll;
typedef		complex<ld>				cld;

#define		all(x)					(x).begin(),(x).end()
#define		len(x)					((ll) (x).size())
#define		F						first
#define		S						second
#define		X						real()
#define		Y						imag()
#define		pb						push_back
#define		sep						' '
#define		endl					'\n'
#define		Mp						make_pair
#define		kill(x)					cout << x << '\n', exit(0)
#define		set_dec(x)				cout << fixed << setprecision(x);
#define		file_io(x,y)			freopen(x, "r", stdin); freopen(y, "w", stdout);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int maxn = 2e5 + 7;

int n, m;
pii A[maxn]; vector<int> res;
bool M[maxn], Mx[maxn];

vector<int> who_wins(vector<int> a, vector<int> r, vector<int> ux, vector<int> vx) {
	n = len(a); m = len(ux);
	for (int i = 0; i < n; i++) A[i] = Mp(a[i], r[i]);
	for (int i = 0; i < m; i++) {
		int u = ux[i], v = vx[i];
		if (u == v) M[u] = 1;
		else Mx[u] = 1;
	}
	res.resize(n);
	
	for (int i = n - 1; i >= 0; i--) {
		if (!M[i]) res[i] = res[i + 1];
		else {
			if (A[i].F == 1) {
				if (A[i].S == 1) res[i] = 1;
				else if (Mx[i]) res[i] = res[i + 1];
				else res[i] = 0;
			}
			else {
				if (A[i].S == 0) res[i] = 0;
				else if (Mx[i]) res[i] = res[i + 1];
				else res[i] = 1;
			}
		}
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 600 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 3 ms 712 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 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 4 ms 856 KB Output is correct
2 Correct 3 ms 860 KB Output is correct
3 Correct 3 ms 860 KB Output is correct
4 Incorrect 3 ms 860 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 4 ms 860 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 5 ms 856 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 4 ms 600 KB Output is correct
2 Correct 2 ms 600 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 2 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 3 ms 604 KB Output is correct
7 Correct 2 ms 604 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 2 ms 604 KB Output is correct
10 Correct 3 ms 712 KB Output is correct
11 Correct 2 ms 604 KB Output is correct
12 Incorrect 0 ms 348 KB 3rd lines differ - on the 2nd token, expected: '1', found: '0'
13 Halted 0 ms 0 KB -