Submission #144299

# Submission time Handle Problem Language Result Execution time Memory
144299 2019-08-16T15:02:47 Z emilem Tenis (COI19_tenis) C++14
21 / 100
82 ms 6976 KB
#include <iostream>
#include <vector>
using namespace std;

vector<int> ranking[4], rankAt[4];
vector<int> tree, lazy;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	int n, q;
	cin >> n >> q;
	ranking[1] = ranking[2] = ranking[3] = vector<int>(n + 1);
	rankAt[1] = rankAt[2] = rankAt[3] = vector<int>(n + 1);
	for (int p = 1; p <= 3; ++p)
		for (int i = 1; i <= n; ++i)
		{
			cin >> ranking[p][i];
			rankAt[p][ranking[p][i]] = i;
		}
	vector<int> worst(n + 1, 0);
	for (int p = 1; p <= 3; ++p)
		for (int i = 1; i <= n; ++i)
			worst[ranking[p][i]] = max(worst[ranking[p][i]], i);
	vector<int> f(n + 1);
	for (int i = 1; i <= n; ++i)
		++f[worst[i]];
	for (int i = 2; i <= n; ++i)
		f[i] += f[i - 1];
	/*
	for (int i = 1; i <= n; ++i)
		cout << worst[i] << ' ';
	cout << endl;
	for (int i = 1; i <= n; ++i)
		cout << f[i] << ' ';
	cout << endl;
	*/
	tree.resize(n * 4);
	lazy.resize(n * 4);
	int winnerBound = 0;
	for (int i = 1; i <= n; ++i)
		if (f[i] == i)
		{
			winnerBound = i;
			break;
		}
	while (q--)
	{
		int type, man;
		cin >> type >> man;
		cout << (worst[man] <= winnerBound ? "DA\n" : "NE\n");
	}

	char I;
	cin >> I;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 64 ms 6976 KB Output is correct
2 Correct 65 ms 6968 KB Output is correct
3 Correct 65 ms 6876 KB Output is correct
4 Correct 63 ms 6904 KB Output is correct
5 Correct 64 ms 6968 KB Output is correct
6 Correct 64 ms 6972 KB Output is correct
7 Correct 65 ms 6844 KB Output is correct
8 Correct 82 ms 6904 KB Output is correct
9 Correct 64 ms 6880 KB Output is correct
10 Correct 63 ms 6908 KB Output is correct
11 Correct 65 ms 6904 KB Output is correct
12 Correct 63 ms 6904 KB Output is correct
13 Correct 64 ms 6904 KB Output is correct
14 Correct 64 ms 6904 KB Output is correct
15 Correct 66 ms 6884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 252 KB Output isn't correct
2 Halted 0 ms 0 KB -