Submission #72553

# Submission time Handle Problem Language Result Execution time Memory
72553 2018-08-26T08:59:14 Z cat > /dev/null(#2231, lobo_prix, jms100300, enochjung) Key of Impassable Doors (FXCUP3_key) C++17
0 / 100
5 ms 1004 KB
#define _CRT_SECURE_NO_WARNINGS
#include "key.h"
#include "bits/stdc++.h"

using namespace std;

void EnsureKeyInfo(int n) {

	int arr[1001];
	for (int i = 1; i <= n; i++)
	{
		TakeKey(i);
		arr[i] = Explore();
	}
	set<int> ss[1001];
	set<int> inv[1001];
	for (int i = 1; i <= n; i++)
	{
		for (int j = i; j <= n; j++)
		{
			if (i == j)
			{
				Report(i, i);
				continue;
			}
			if (inv[i].find(j) != inv[i].end() || inv[j].find(i) != inv[j].end())
				continue;

			TakeKey(i);
			TakeKey(j);
			int res = Explore();
			if (res <= max(arr[i], arr[j]))
			{
				if (arr[i] > arr[j])
				{
					Report(i, j);
				}
				else if (arr[i] < arr[j])
				{
					Report(j, i);
				}
				else
					Report(i, j), Report(j, i);
				ss[i].insert(j);
				ss[j].insert(i);
			}
			else
			{
				for (auto k : ss[i])
					inv[j].insert(k);
				for (auto k : ss[j])
					inv[i].insert(k);
				inv[i].insert(j);
				inv[j].insert(i);
			}
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 5 ms 1004 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 5 ms 1004 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Runtime error 5 ms 1004 KB Execution failed because the return code was nonzero
3 Halted 0 ms 0 KB -