#include <bits/stdc++.h>
#include "meetings.h"
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
template <class T>
void read(T &x)
{
x = 0;
register int c;
while ((c = getchar()) && (c > '9' || c < '0'))
;
for (; c >= '0' && c <= '9'; c = getchar())
x = x * 10 + c - '0';
}
constexpr bool typetest = 0;
constexpr int N = 2e3 + 5;
bool ck[N];
void Recursive(vector<int> &s)
{
if (s.size() <= 1)
return;
if (s.size() == 2)
{
Bridge(min(s[0], s[1]), max(s[0], s[1]));
return;
}
int u = s[0], v = s[1];
vector<int> l, r, use;
for (int i = 2; i < (int)s.size(); ++i)
use.emplace_back(s[i]);
while (!use.empty())
{
if (use.back() == u || use.back() == v)
{
use.pop_back();
continue;
}
int z = Query(u, v, use.back());
if (z == u)
r.emplace_back(use.back());
else if (z == v)
l.emplace_back(use.back());
else
{
if (use.back() != z)
l.emplace_back(use.back());
l.emplace_back(v);
v = z;
}
use.pop_back();
}
Bridge(min(u, v), max(u, v));
l.emplace_back(v);
r.emplace_back(u);
Recursive(l);
Recursive(r);
}
void Solve(int n)
{
vector<int> s;
for (int i = 0; i < n; ++i)
s.emplace_back(i);
Recursive(s);
}
/*
void Read()
{
}
void Solve()
{
}
int32_t main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
if (fopen("xor.INP", "r"))
{
freopen("xor.inp", "r", stdin);
freopen("xor.out", "w", stdout);
}
int t(1);
if (typetest)
cin >> t;
for (int _ = 1; _ <= t; ++_)
{
// cout << "Case #" << _ << ": ";
Read();
Solve();
}
// cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
}
*/
Compilation message
meetings.cpp: In function 'void read(T&)':
meetings.cpp:13:18: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
13 | register int c;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
328 KB |
Output is correct |
5 |
Correct |
0 ms |
328 KB |
Output is correct |
6 |
Correct |
0 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
0 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
0 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
328 KB |
Output is correct |
5 |
Correct |
0 ms |
328 KB |
Output is correct |
6 |
Correct |
0 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
0 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
0 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
1 ms |
328 KB |
Output is correct |
17 |
Correct |
1 ms |
328 KB |
Output is correct |
18 |
Correct |
1 ms |
328 KB |
Output is correct |
19 |
Correct |
1 ms |
328 KB |
Output is correct |
20 |
Correct |
1 ms |
328 KB |
Output is correct |
21 |
Correct |
1 ms |
328 KB |
Output is correct |
22 |
Correct |
1 ms |
328 KB |
Output is correct |
23 |
Correct |
2 ms |
328 KB |
Output is correct |
24 |
Correct |
1 ms |
328 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
26 |
Correct |
1 ms |
328 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
328 KB |
Output is correct |
2 |
Correct |
1 ms |
328 KB |
Output is correct |
3 |
Correct |
0 ms |
328 KB |
Output is correct |
4 |
Correct |
0 ms |
328 KB |
Output is correct |
5 |
Correct |
0 ms |
328 KB |
Output is correct |
6 |
Correct |
0 ms |
328 KB |
Output is correct |
7 |
Correct |
1 ms |
328 KB |
Output is correct |
8 |
Correct |
0 ms |
328 KB |
Output is correct |
9 |
Correct |
1 ms |
328 KB |
Output is correct |
10 |
Correct |
1 ms |
328 KB |
Output is correct |
11 |
Correct |
0 ms |
328 KB |
Output is correct |
12 |
Correct |
1 ms |
328 KB |
Output is correct |
13 |
Correct |
0 ms |
328 KB |
Output is correct |
14 |
Correct |
1 ms |
328 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
1 ms |
328 KB |
Output is correct |
17 |
Correct |
1 ms |
328 KB |
Output is correct |
18 |
Correct |
1 ms |
328 KB |
Output is correct |
19 |
Correct |
1 ms |
328 KB |
Output is correct |
20 |
Correct |
1 ms |
328 KB |
Output is correct |
21 |
Correct |
1 ms |
328 KB |
Output is correct |
22 |
Correct |
1 ms |
328 KB |
Output is correct |
23 |
Correct |
2 ms |
328 KB |
Output is correct |
24 |
Correct |
1 ms |
328 KB |
Output is correct |
25 |
Correct |
1 ms |
328 KB |
Output is correct |
26 |
Correct |
1 ms |
328 KB |
Output is correct |
27 |
Correct |
13 ms |
412 KB |
Output is correct |
28 |
Correct |
10 ms |
328 KB |
Output is correct |
29 |
Correct |
14 ms |
448 KB |
Output is correct |
30 |
Correct |
12 ms |
416 KB |
Output is correct |
31 |
Correct |
16 ms |
456 KB |
Output is correct |
32 |
Correct |
12 ms |
328 KB |
Output is correct |
33 |
Correct |
13 ms |
328 KB |
Output is correct |
34 |
Correct |
18 ms |
444 KB |
Output is correct |
35 |
Correct |
14 ms |
388 KB |
Output is correct |
36 |
Correct |
9 ms |
328 KB |
Output is correct |
37 |
Correct |
27 ms |
432 KB |
Output is correct |
38 |
Correct |
43 ms |
456 KB |
Output is correct |
39 |
Correct |
103 ms |
924 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1468 ms |
956 KB |
Output is correct |
2 |
Correct |
1698 ms |
1088 KB |
Output is correct |
3 |
Correct |
1601 ms |
996 KB |
Output is correct |
4 |
Execution timed out |
2172 ms |
1324 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |