#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())
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 |
380 KB |
Output is correct |
2 |
Correct |
6 ms |
996 KB |
Output is correct |
3 |
Correct |
5 ms |
1072 KB |
Output is correct |
4 |
Correct |
5 ms |
1148 KB |
Output is correct |
5 |
Correct |
5 ms |
1224 KB |
Output is correct |
6 |
Correct |
7 ms |
1256 KB |
Output is correct |
7 |
Correct |
10 ms |
1520 KB |
Output is correct |
8 |
Correct |
11 ms |
1520 KB |
Output is correct |
9 |
Correct |
11 ms |
1520 KB |
Output is correct |
10 |
Correct |
7 ms |
1520 KB |
Output is correct |
11 |
Correct |
11 ms |
1520 KB |
Output is correct |
12 |
Correct |
9 ms |
1520 KB |
Output is correct |
13 |
Correct |
7 ms |
1520 KB |
Output is correct |
14 |
Correct |
12 ms |
1520 KB |
Output is correct |
15 |
Correct |
13 ms |
1520 KB |
Output is correct |
16 |
Correct |
11 ms |
1520 KB |
Output is correct |
17 |
Correct |
14 ms |
1520 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
6 ms |
996 KB |
Output is correct |
3 |
Correct |
5 ms |
1072 KB |
Output is correct |
4 |
Correct |
5 ms |
1148 KB |
Output is correct |
5 |
Correct |
5 ms |
1224 KB |
Output is correct |
6 |
Correct |
7 ms |
1256 KB |
Output is correct |
7 |
Correct |
10 ms |
1520 KB |
Output is correct |
8 |
Correct |
11 ms |
1520 KB |
Output is correct |
9 |
Correct |
11 ms |
1520 KB |
Output is correct |
10 |
Correct |
7 ms |
1520 KB |
Output is correct |
11 |
Correct |
11 ms |
1520 KB |
Output is correct |
12 |
Correct |
9 ms |
1520 KB |
Output is correct |
13 |
Correct |
7 ms |
1520 KB |
Output is correct |
14 |
Correct |
12 ms |
1520 KB |
Output is correct |
15 |
Correct |
13 ms |
1520 KB |
Output is correct |
16 |
Correct |
11 ms |
1520 KB |
Output is correct |
17 |
Correct |
14 ms |
1520 KB |
Output is correct |
18 |
Runtime error |
33 ms |
4332 KB |
Execution failed because the return code was nonzero |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Correct |
6 ms |
996 KB |
Output is correct |
3 |
Correct |
5 ms |
1072 KB |
Output is correct |
4 |
Correct |
5 ms |
1148 KB |
Output is correct |
5 |
Correct |
5 ms |
1224 KB |
Output is correct |
6 |
Correct |
7 ms |
1256 KB |
Output is correct |
7 |
Correct |
10 ms |
1520 KB |
Output is correct |
8 |
Correct |
11 ms |
1520 KB |
Output is correct |
9 |
Correct |
11 ms |
1520 KB |
Output is correct |
10 |
Correct |
7 ms |
1520 KB |
Output is correct |
11 |
Correct |
11 ms |
1520 KB |
Output is correct |
12 |
Correct |
9 ms |
1520 KB |
Output is correct |
13 |
Correct |
7 ms |
1520 KB |
Output is correct |
14 |
Correct |
12 ms |
1520 KB |
Output is correct |
15 |
Correct |
13 ms |
1520 KB |
Output is correct |
16 |
Correct |
11 ms |
1520 KB |
Output is correct |
17 |
Correct |
14 ms |
1520 KB |
Output is correct |
18 |
Runtime error |
33 ms |
4332 KB |
Execution failed because the return code was nonzero |
19 |
Halted |
0 ms |
0 KB |
- |