QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#133970 | #6261. Inquiry II | KhNURE_KIVI# | AC ✓ | 2378ms | 17368kb | C++17 | 5.9kb | 2023-08-02 19:05:50 | 2023-08-02 19:05:53 |
Judging History
answer
//#pragma GCC optimize("Ofast", "unroll-loops")
//#pragma GCC target("sse", "sse2", "sse3", "ssse3", "sse4")
#ifdef LOCAL
#include <iostream>
#include <cmath>
#include <algorithm>
#include <stdio.h>
#include <cstdint>
#include <cstring>
#include <string>
#include <cstdlib>
#include <vector>
#include <bitset>
#include <map>
#include <queue>
#include <ctime>
#include <stack>
#include <set>
#include <list>
#include <random>
#include <deque>
#include <functional>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <complex>
#include <numeric>
#include <cassert>
#include <array>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <thread>
#else
#include <bits/stdc++.h>
#endif
#define all(a) a.begin(),a.end()
#define len(a) (int)(a.size())
#define mp make_pair
#define pb push_back
#define fir first
#define sec second
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double ld;
template<typename T>
inline bool umin(T &a, T b) {
if (b < a) {
a = b;
return true;
}
return false;
}
//template<typename T>
//inline bool umax(T &a, T b) {
// if (a < b) {
// a = b;
// return true;
// }
// return false;
//}
template<typename T, typename T1>
inline bool umax(T &a, T1 b) {
if (a < b) {
a = b;
return true;
}
return false;
}
#ifdef LOCAL
#define D for (bool _FLAG = true; _FLAG; _FLAG = false)
#define LOG(...) print(#__VA_ARGS__" ::", __VA_ARGS__) << endl
template <class ...Ts> auto &print(Ts ...ts) { return ((cerr << ts << " "), ...); }
#else
#define D while (false)
#define LOG(...)
#endif // LOCAL
const int max_n = 111, inf = 1000111222;
set <pii> edges;
vector <pii> bad;
vector <int> edge[max_n];
bool used[max_n] = {};
inline void dfs (int v) {
used[v] = true;
for (int to : edge[v]) {
if (!used[to]) {
dfs(to);
edges.insert({v, to});
edges.insert({to, v});
}
}
}
int e_mask[max_n] = {};
using base = char;
base dp[max_n][1 << 16][2] = {};
int k;
int was[max_n] = {};
inline void dfs_solve (int v, int p = -1) {
dp[v][e_mask[v]][1] = 1;
if (e_mask[v]) {
was[v] = 1;
}
bool ok = !was[v];
for (int to : edge[v]) {
if (to == p) {
continue;
}
dfs_solve(to, v);
was[v] |= was[to];
if (!was[to] || ok) {
ok = false;
for (int mask = (1 << k) - 1; mask >= 0; mask--) {
dp[v][mask][0] += max(dp[to][0][1], dp[to][0][0]);
dp[v][mask][1] += dp[to][0][0];
if (mask) {
umax(dp[v][mask][0], dp[v][0][0] + dp[to][mask][1]);
umax(dp[v][mask][0], dp[v][0][0] + dp[to][mask][0]);
umax(dp[v][mask][1], dp[v][0][1] + dp[to][mask][0]);
}
}
continue;
}
for (int mask = (1 << k) - 1; mask >= 0; mask--) {
dp[v][mask][0] += max(dp[to][0][1], dp[to][0][0]);
dp[v][mask][1] += dp[to][0][0];
if (mask) {
umax(dp[v][mask][0], dp[v][0][0] + dp[to][mask][1]);
umax(dp[v][mask][0], dp[v][0][0] + dp[to][mask][0]);
umax(dp[v][mask][1], dp[v][0][1] + dp[to][mask][0]);
}
for (int submask = mask & (mask - 1); submask; submask = (mask & (submask - 1))) {
umax(dp[v][mask][0], dp[v][submask][0] + dp[to][mask ^ submask][1]);
umax(dp[v][mask][0], dp[v][submask][0] + dp[to][mask ^ submask][0]);
umax(dp[v][mask][1], dp[v][submask][1] + dp[to][mask ^ submask][0]);
}
}
}
}
const int debug = 0;
mt19937 rng(228);
template<typename T = int>
inline T randll(T l = INT_MIN, T r = INT_MAX) {
return uniform_int_distribution<T>(l, r)(rng);
}
inline ld randld(ld l = INT_MIN, ld r = INT_MAX) {
return uniform_real_distribution<ld>(l, r)(rng);
}
int main() {
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector <pii> e(m);
for (int i = 0, a, b; i < m; i++) {
if (debug) {
if (i < n - 1) {
a = i, b = i + 1;
}
else {
while (true) {
a = randll(0, n - 1);
b = randll(0, n - 1);
bool ok = a != b;
for (int j = 0; j < i; j++) {
if (e[j] == make_pair(a, b) || e[j] == make_pair(b, a)) {
ok = false;
}
}
if (ok) {
break;
}
}
}
}
else {
cin >> a >> b;
--a, --b;
}
edge[a].pb(b);
edge[b].pb(a);
e[i] = {a, b};
}
dfs(0);
for (int i = 0; i < n; i++) {
edge[i].clear();
}
for (int i = 0; i < m; i++) {
if (edges.count(e[i])) {
edge[e[i].first].pb(e[i].second);
edge[e[i].second].pb(e[i].first);
continue;
}
bad.pb(e[i]);
}
k = len(bad);
for (int i = 0; i < n; i++) {
for (int j = 0; j < k; j++) {
if (bad[j].first == i || bad[j].second == i) {
e_mask[i] |= 1 << j;
}
}
}
int root = 0;
dfs_solve(root);
base ans = 0;
for (int i = 0; i < (1 << k); i++) {
umax(ans, dp[root][i][0]);
umax(ans, dp[root][i][1]);
}
cout << int(ans) << '\n';
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3492kb
input:
2 1 1 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3552kb
input:
4 5 1 2 2 3 3 4 4 1 1 3
output:
2
result:
ok single line: '2'
Test #3:
score: 0
Accepted
time: 2294ms
memory: 16416kb
input:
99 114 44 92 68 20 3 85 77 13 14 81 27 96 84 53 5 33 83 50 3 33 27 71 47 72 26 99 84 99 34 95 34 45 49 80 63 66 34 92 78 96 94 69 6 24 47 13 52 15 78 58 47 4 48 72 16 21 76 45 14 89 87 40 6 50 2 81 18 97 34 1 78 51 48 23 86 89 48 80 68 28 67 45 67 46 83 36 30 12 55 58 8 40 86 61 37 66 84 57 10 88 8 ...
output:
58
result:
ok single line: '58'
Test #4:
score: 0
Accepted
time: 2365ms
memory: 16188kb
input:
100 115 83 51 49 32 38 86 57 78 67 93 65 54 23 10 40 30 7 41 100 53 57 99 52 75 80 5 52 81 94 5 57 14 100 41 70 53 11 58 26 66 80 1 12 69 80 91 83 34 82 30 38 35 52 35 26 36 38 51 7 59 56 13 56 51 65 81 11 21 52 5 82 59 85 5 71 9 87 19 11 59 87 95 20 90 2 1 11 72 46 10 68 30 100 14 55 58 38 59 67 91...
output:
60
result:
ok single line: '60'
Test #5:
score: 0
Accepted
time: 1ms
memory: 15904kb
input:
100 101 8 12 20 77 38 86 41 68 41 47 8 97 23 80 72 56 78 92 28 27 8 65 95 18 20 47 53 31 98 56 79 92 40 21 71 82 50 91 90 58 64 51 43 32 53 75 87 10 35 10 26 22 28 44 20 18 74 47 90 80 100 75 23 51 74 63 70 97 16 97 64 49 35 18 26 21 29 65 78 75 14 56 79 97 28 92 35 51 74 9 40 82 93 69 79 67 95 32 5...
output:
62
result:
ok single line: '62'
Test #6:
score: 0
Accepted
time: 2125ms
memory: 16860kb
input:
100 115 44 60 50 27 32 93 39 93 52 47 82 95 83 10 5 31 79 89 41 1 30 2 96 54 82 81 49 57 34 59 82 90 38 40 46 42 37 8 49 73 71 10 45 88 49 81 74 73 84 51 84 40 84 47 21 36 80 69 39 43 71 25 30 70 32 86 91 1 76 54 66 15 5 69 38 70 48 75 63 20 17 57 44 59 50 100 85 40 80 4 84 20 37 67 66 81 46 54 74 2...
output:
54
result:
ok single line: '54'
Test #7:
score: 0
Accepted
time: 0ms
memory: 7704kb
input:
45 47 23 2 40 22 6 26 25 11 31 24 35 24 40 17 1 12 30 2 4 16 7 42 25 18 30 8 38 32 30 11 38 5 44 24 23 9 45 20 23 10 13 42 37 43 45 24 19 27 19 32 31 9 33 32 31 17 33 8 3 21 29 21 6 21 31 28 36 11 29 24 38 15 41 21 36 42 14 39 4 18 14 16 33 12 37 22 34 42 31 11 40 5 25 16
output:
27
result:
ok single line: '27'
Test #8:
score: 0
Accepted
time: 0ms
memory: 11764kb
input:
67 72 42 15 41 5 1 56 8 52 61 5 43 62 28 15 19 56 42 25 43 12 37 34 9 45 14 5 18 66 67 27 2 27 35 29 14 59 2 26 2 60 42 24 35 25 3 29 1 52 67 20 21 64 22 20 22 44 35 53 49 13 28 52 61 66 61 25 1 12 58 5 21 26 14 40 33 12 48 62 42 11 2 53 9 24 48 34 16 12 50 64 17 66 38 6 57 59 42 63 51 23 48 31 38 4...
output:
39
result:
ok single line: '39'
Test #9:
score: 0
Accepted
time: 1805ms
memory: 11148kb
input:
61 76 32 34 32 47 38 50 17 30 33 4 33 60 48 3 31 19 6 44 27 54 8 34 18 58 18 61 41 47 31 58 6 4 15 14 31 45 20 55 20 4 17 21 52 34 39 21 11 28 43 47 1 14 39 45 10 22 59 19 8 61 17 57 59 4 15 3 5 14 10 50 40 46 32 46 12 29 1 30 8 28 43 36 31 42 20 7 2 49 9 7 38 45 8 54 56 35 51 30 20 23 13 22 43 49 1...
output:
32
result:
ok single line: '32'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3616kb
input:
9 8 8 6 5 7 8 7 4 7 4 2 3 2 5 1 5 9
output:
5
result:
ok single line: '5'
Test #11:
score: 0
Accepted
time: 1ms
memory: 5644kb
input:
7 7 2 3 7 5 7 6 4 6 7 3 1 3 1 5
output:
4
result:
ok single line: '4'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3488kb
input:
5 5 2 5 2 1 3 5 2 4 3 4
output:
3
result:
ok single line: '3'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3576kb
input:
15 24 12 3 12 9 2 7 11 6 4 15 13 3 12 7 1 10 14 3 13 15 1 9 11 10 12 5 8 6 4 9 13 10 13 6 2 10 2 15 8 5 2 9 13 9 11 15 1 15
output:
8
result:
ok single line: '8'
Test #14:
score: 0
Accepted
time: 960ms
memory: 5104kb
input:
15 30 8 1 8 3 11 15 10 15 8 15 5 1 9 1 4 15 11 7 11 12 4 13 11 2 6 13 14 15 9 13 6 12 14 1 9 2 6 2 10 3 11 13 5 15 10 12 8 7 5 13 8 13 11 1 14 12 4 7 11 3
output:
8
result:
ok single line: '8'
Test #15:
score: 0
Accepted
time: 477ms
memory: 12608kb
input:
70 84 1 8 8 9 9 10 10 2 1 11 11 12 12 13 13 3 1 14 14 15 15 16 16 4 1 17 17 18 18 19 19 5 1 20 20 21 21 22 22 6 1 23 23 24 24 25 25 7 2 26 26 27 27 28 28 3 2 29 29 30 30 31 31 4 2 32 32 33 33 34 34 5 2 35 35 36 36 37 37 6 2 38 38 39 39 40 40 7 3 41 41 42 42 43 43 4 3 44 44 45 45 46 46 5 3 47 47 48 4...
output:
42
result:
ok single line: '42'
Test #16:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
2 1 1 2
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 1ms
memory: 3500kb
input:
3 3 1 2 3 1 3 2
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 1ms
memory: 3496kb
input:
4 6 1 2 3 1 3 2 4 1 4 2 4 3
output:
1
result:
ok single line: '1'
Test #19:
score: 0
Accepted
time: 0ms
memory: 5540kb
input:
5 10 1 2 3 1 3 2 4 1 4 2 4 3 5 1 5 2 5 3 5 4
output:
1
result:
ok single line: '1'
Test #20:
score: 0
Accepted
time: 2ms
memory: 5544kb
input:
6 15 1 2 3 1 3 2 4 1 4 2 4 3 5 1 5 2 5 3 5 4 6 1 6 2 6 3 6 4 6 5
output:
1
result:
ok single line: '1'
Test #21:
score: 0
Accepted
time: 8ms
memory: 5764kb
input:
24 34 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 1 9 12 8 13 7 14 6 15 5 16 4 17 3 18 2 19 1 20 24 21
output:
12
result:
ok single line: '12'
Test #22:
score: 0
Accepted
time: 1ms
memory: 3632kb
input:
11 11 1 2 2 3 3 4 4 2 5 3 6 2 7 3 8 2 9 3 10 2 11 3
output:
9
result:
ok single line: '9'
Test #23:
score: 0
Accepted
time: 1ms
memory: 5532kb
input:
11 11 1 2 2 3 3 4 2 4 5 4 6 2 7 4 8 2 9 4 10 2 11 4
output:
9
result:
ok single line: '9'
Test #24:
score: 0
Accepted
time: 2355ms
memory: 16920kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
50
result:
ok single line: '50'
Test #25:
score: 0
Accepted
time: 2378ms
memory: 16704kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
50
result:
ok single line: '50'
Test #26:
score: 0
Accepted
time: 2351ms
memory: 16184kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
49
result:
ok single line: '49'
Test #27:
score: 0
Accepted
time: 2373ms
memory: 16648kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
49
result:
ok single line: '49'
Test #28:
score: 0
Accepted
time: 2348ms
memory: 17068kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
49
result:
ok single line: '49'
Test #29:
score: 0
Accepted
time: 2355ms
memory: 16592kb
input:
100 115 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 ...
output:
49
result:
ok single line: '49'
Test #30:
score: 0
Accepted
time: 9ms
memory: 3572kb
input:
10 21 1 2 1 4 2 3 2 8 3 7 3 9 3 5 3 6 3 8 4 5 5 6 5 10 5 9 5 8 5 7 6 9 6 8 6 7 7 9 7 8 8 9
output:
4
result:
ok single line: '4'
Test #31:
score: 0
Accepted
time: 1ms
memory: 5612kb
input:
10 14 1 2 1 4 1 7 1 10 2 3 2 8 2 4 3 7 4 5 4 7 5 6 5 10 6 9 9 10
output:
5
result:
ok single line: '5'
Test #32:
score: 0
Accepted
time: 2ms
memory: 5572kb
input:
10 14 1 2 1 4 1 9 2 3 2 8 2 5 3 7 3 4 4 5 5 6 5 10 6 9 6 10 7 8
output:
5
result:
ok single line: '5'
Test #33:
score: 0
Accepted
time: 2ms
memory: 5672kb
input:
10 15 1 2 1 4 1 8 2 3 2 8 2 4 3 7 3 6 4 5 4 7 5 6 5 10 6 9 7 9 8 9
output:
4
result:
ok single line: '4'
Test #34:
score: 0
Accepted
time: 8ms
memory: 5600kb
input:
10 21 1 2 1 3 1 4 1 9 1 8 1 7 1 10 2 8 2 3 2 7 2 10 3 5 3 6 3 7 3 8 3 10 4 8 7 8 7 10 8 10 9 10
output:
5
result:
ok single line: '5'
Test #35:
score: 0
Accepted
time: 2ms
memory: 5584kb
input:
10 12 1 2 1 3 1 4 1 9 3 5 3 6 3 7 4 8 4 5 6 8 6 7 9 10
output:
5
result:
ok single line: '5'
Test #36:
score: 0
Accepted
time: 2ms
memory: 5600kb
input:
10 15 1 2 1 3 1 4 1 9 1 5 2 8 3 5 3 6 3 7 4 8 4 7 5 10 6 9 6 8 9 10
output:
4
result:
ok single line: '4'
Test #37:
score: 0
Accepted
time: 1ms
memory: 3596kb
input:
10 13 1 2 1 3 1 4 1 9 1 7 2 4 3 5 3 6 3 7 4 8 5 10 8 9 9 10
output:
5
result:
ok single line: '5'
Test #38:
score: 0
Accepted
time: 2ms
memory: 5592kb
input:
10 9 1 2 1 3 1 4 1 9 3 5 3 6 3 7 4 8 9 10
output:
6
result:
ok single line: '6'
Test #39:
score: 0
Accepted
time: 23ms
memory: 3636kb
input:
10 22 1 2 1 3 2 4 2 6 3 9 3 10 3 6 3 4 3 8 4 5 4 7 4 10 4 9 4 6 4 8 5 8 6 9 6 10 6 8 8 9 8 10 9 10
output:
4
result:
ok single line: '4'
Test #40:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 15 1 2 1 3 1 9 2 4 2 6 3 6 3 7 4 5 4 7 4 10 4 6 5 8 5 9 8 9 8 10
output:
5
result:
ok single line: '5'
Test #41:
score: 0
Accepted
time: 1ms
memory: 3520kb
input:
10 12 1 2 1 3 1 6 2 4 2 6 2 5 3 10 4 5 4 7 4 10 5 8 8 9
output:
5
result:
ok single line: '5'
Test #42:
score: 0
Accepted
time: 2ms
memory: 5672kb
input:
10 17 1 2 1 3 1 9 2 4 2 6 2 10 2 7 3 4 4 5 4 7 4 10 5 8 5 9 6 10 6 8 7 8 8 9
output:
4
result:
ok single line: '4'
Test #43:
score: 0
Accepted
time: 1ms
memory: 3512kb
input:
10 9 1 2 1 3 2 4 2 6 4 5 4 7 4 10 5 8 8 9
output:
6
result:
ok single line: '6'
Test #44:
score: 0
Accepted
time: 281ms
memory: 16744kb
input:
100 114 1 2 1 4 1 12 1 21 1 59 1 70 2 3 2 6 2 9 2 48 3 8 3 27 3 76 4 5 4 37 5 36 5 42 5 56 6 7 6 29 6 33 6 51 6 58 7 11 8 10 8 13 8 54 9 15 9 16 9 19 9 39 9 55 10 18 12 14 12 98 13 20 13 22 13 23 13 25 13 35 13 63 14 17 15 31 15 87 18 24 18 30 19 26 19 83 20 34 21 66 23 45 23 53 24 43 24 97 25 28 26...
output:
57
result:
ok single line: '57'
Test #45:
score: 0
Accepted
time: 12ms
memory: 9816kb
input:
50 61 1 2 1 4 1 12 1 21 2 3 2 6 2 9 2 48 2 14 2 46 3 8 3 27 3 44 3 38 4 5 4 37 5 36 5 42 6 7 6 29 6 33 7 11 8 10 8 13 9 15 9 16 9 19 9 39 10 18 10 33 12 14 13 20 13 22 13 23 13 25 13 35 14 17 14 19 15 31 17 46 17 21 18 24 18 30 19 26 19 32 20 34 23 45 24 43 25 28 26 38 29 47 30 32 30 41 32 46 32 38 ...
output:
26
result:
ok single line: '26'
Test #46:
score: 0
Accepted
time: 1ms
memory: 15808kb
input:
100 105 1 2 1 4 1 12 1 21 1 59 1 70 2 3 2 6 2 9 2 48 3 8 3 27 3 76 4 5 4 37 5 36 5 42 5 56 6 7 6 29 6 33 6 51 6 58 7 11 8 10 8 13 8 54 9 15 9 16 9 19 9 39 9 55 10 18 12 14 12 98 13 20 13 22 13 23 13 25 13 35 13 63 14 17 15 31 15 87 18 24 18 30 19 26 19 83 20 34 21 66 23 45 23 53 24 43 24 97 25 28 26...
output:
57
result:
ok single line: '57'
Test #47:
score: 0
Accepted
time: 331ms
memory: 16608kb
input:
100 114 1 2 1 4 1 5 1 6 1 18 1 54 1 100 2 3 2 22 3 10 3 15 3 21 3 67 4 7 4 41 6 8 6 31 6 80 6 87 6 94 7 9 7 11 7 16 7 44 7 49 8 32 8 42 9 17 9 23 9 27 9 61 10 12 10 92 10 96 10 70 10 11 10 15 10 87 11 19 11 20 11 75 11 83 11 96 11 70 11 15 11 87 12 13 12 14 12 65 13 25 13 48 13 55 14 45 15 76 15 96 ...
output:
60
result:
ok single line: '60'
Test #48:
score: 0
Accepted
time: 18ms
memory: 9796kb
input:
50 61 1 2 1 4 1 5 1 6 1 18 1 39 1 21 2 3 2 22 3 10 3 15 3 21 4 7 4 41 5 27 5 29 6 8 6 31 7 9 7 11 7 16 7 44 7 49 8 32 8 42 9 17 9 23 9 27 10 12 10 16 10 35 11 19 11 20 12 13 12 14 13 25 13 48 14 45 16 29 19 26 19 33 20 24 20 28 21 41 23 29 23 30 23 39 23 47 24 35 24 27 27 40 28 34 28 41 30 38 34 36 ...
output:
27
result:
ok single line: '27'
Test #49:
score: 0
Accepted
time: 2127ms
memory: 17368kb
input:
100 115 1 2 1 4 1 5 1 6 1 18 1 54 1 100 2 3 2 22 3 10 3 15 3 21 3 67 4 7 4 41 4 33 5 57 6 8 6 31 6 80 6 87 6 94 6 58 7 9 7 11 7 16 7 44 7 49 8 32 8 42 9 17 9 23 9 27 9 61 10 12 10 92 11 19 11 20 11 75 11 83 12 13 12 14 12 65 12 53 13 25 13 48 13 55 14 45 14 93 15 76 18 84 18 50 19 26 19 33 20 24 20 ...
output:
59
result:
ok single line: '59'
Test #50:
score: 0
Accepted
time: 89ms
memory: 16068kb
input:
100 113 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 4 13 4 18 4 77 4 96 5 31 5 57 5 70 5 94 6 16 6 21 6 22 6 45 6 81 7 10 7 17 7 24 7 29 7 33 7 44 8 12 8 19 9 23 11 14 11 40 13 27 13 42 13 82 13 18 13 32 13 47 14 15 14 20 14 35 14 36 15 66 16 37 17 25 18 42 18 82 18 32 18 47 19 41 19 58 19 6...
output:
57
result:
ok single line: '57'
Test #51:
score: 0
Accepted
time: 3ms
memory: 9860kb
input:
50 60 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 4 13 4 18 5 31 6 16 6 21 6 22 6 45 6 44 7 10 7 17 7 24 7 29 7 33 7 44 7 27 8 12 8 19 9 23 9 49 9 28 11 14 11 40 13 27 13 29 13 49 14 15 14 20 14 35 14 36 16 37 17 25 17 29 19 41 20 50 21 43 21 27 22 28 22 32 24 38 26 39 28 43 28 44 33 43 35 4...
output:
28
result:
ok single line: '28'
Test #52:
score: 0
Accepted
time: 1ms
memory: 15868kb
input:
100 105 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 4 13 4 18 4 77 4 96 4 63 4 72 5 31 5 57 5 70 5 94 6 16 6 21 6 22 6 45 6 81 7 10 7 17 7 24 7 29 7 33 7 44 8 12 8 19 9 23 11 14 11 40 13 27 14 15 14 20 14 35 14 36 15 66 16 37 17 25 19 41 19 58 19 64 20 50 21 63 22 28 22 32 22 51 22 78 23 90 ...
output:
58
result:
ok single line: '58'
Test #53:
score: 0
Accepted
time: 622ms
memory: 16772kb
input:
100 114 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 3 32 4 13 4 18 4 77 4 96 5 31 5 57 5 70 5 94 6 16 6 21 6 22 6 45 6 81 7 10 7 17 7 24 7 29 7 33 7 44 8 12 8 19 9 23 9 22 10 39 11 14 11 40 13 27 13 46 14 15 14 20 14 35 14 36 14 83 15 66 15 95 16 37 17 25 18 54 19 41 19 58 19 64 20 50 21 63 ...
output:
55
result:
ok single line: '55'
Test #54:
score: 0
Accepted
time: 1744ms
memory: 17276kb
input:
100 115 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 4 13 4 18 4 77 4 96 5 31 5 57 5 70 5 94 6 16 6 21 6 22 6 45 6 81 7 10 7 17 7 24 7 29 7 33 7 44 8 12 8 19 8 76 9 23 10 47 11 14 11 40 13 27 13 94 14 15 14 20 14 35 14 36 15 66 16 37 17 25 19 41 19 58 19 64 20 50 21 63 22 28 22 32 22 51 22 78...
output:
57
result:
ok single line: '57'
Test #55:
score: 0
Accepted
time: 0ms
memory: 15896kb
input:
100 99 1 2 1 5 1 7 1 8 1 9 2 3 2 4 2 6 2 26 2 34 3 11 3 30 4 13 4 18 4 77 4 96 5 31 5 57 5 70 5 94 6 16 6 21 6 22 6 45 6 81 7 10 7 17 7 24 7 29 7 33 7 44 8 12 8 19 9 23 11 14 11 40 13 27 14 15 14 20 14 35 14 36 15 66 16 37 17 25 19 41 19 58 19 64 20 50 21 63 22 28 22 32 22 51 22 78 23 90 24 38 24 89...
output:
59
result:
ok single line: '59'
Test #56:
score: 0
Accepted
time: 334ms
memory: 15048kb
input:
100 114 1 2 1 3 1 98 2 4 2 5 2 8 2 39 2 42 3 11 3 52 3 79 4 6 4 7 4 13 5 10 5 15 5 64 5 85 7 24 7 51 8 9 8 12 8 21 8 23 8 26 8 30 8 38 8 69 9 19 9 34 9 45 10 37 10 43 10 50 10 53 11 18 11 25 11 27 11 84 11 92 11 42 11 20 11 56 11 28 12 77 13 14 13 17 13 20 13 29 13 32 13 47 13 78 14 16 15 28 17 61 1...
output:
57
result:
ok single line: '57'
Test #57:
score: 0
Accepted
time: 454ms
memory: 10292kb
input:
50 64 1 2 1 3 2 4 2 5 2 8 2 39 2 42 2 29 2 41 3 11 4 6 4 7 4 13 4 41 4 37 5 10 5 15 7 24 8 9 8 12 8 21 8 23 8 26 8 30 8 38 9 19 9 34 9 45 9 37 9 28 10 37 10 43 10 50 11 18 11 25 11 27 11 30 11 26 13 14 13 17 13 20 13 29 13 32 13 47 14 16 15 28 18 22 19 31 20 41 20 46 20 50 20 24 24 33 24 29 25 44 26...
output:
29
result:
ok single line: '29'
Test #58:
score: 0
Accepted
time: 2155ms
memory: 16100kb
input:
100 115 1 2 1 3 1 98 2 4 2 5 2 8 2 39 2 42 3 11 3 52 3 79 4 6 4 7 4 13 5 10 5 15 5 64 5 85 7 24 7 51 8 9 8 12 8 21 8 23 8 26 8 30 8 38 8 69 9 19 9 34 9 45 10 37 10 43 10 50 10 53 11 18 11 25 11 27 11 84 11 24 12 77 12 86 13 14 13 17 13 20 13 29 13 32 13 47 13 78 14 16 15 28 17 61 17 78 18 22 18 90 1...
output:
55
result:
ok single line: '55'
Test #59:
score: 0
Accepted
time: 1974ms
memory: 16900kb
input:
100 115 1 2 1 3 1 98 2 4 2 5 2 8 2 39 2 42 3 11 3 52 3 79 3 35 4 6 4 7 4 13 5 10 5 15 5 64 5 85 5 16 6 76 7 24 7 51 7 42 8 9 8 12 8 21 8 23 8 26 8 30 8 38 8 69 9 19 9 34 9 45 10 37 10 43 10 50 10 53 11 18 11 25 11 27 11 84 11 90 12 77 13 14 13 17 13 20 13 29 13 32 13 47 13 78 14 16 15 28 17 61 18 22...
output:
55
result:
ok single line: '55'
Test #60:
score: 0
Accepted
time: 3ms
memory: 15916kb
input:
100 99 1 2 1 3 1 98 2 4 2 5 2 8 2 39 2 42 3 11 3 52 3 79 4 6 4 7 4 13 5 10 5 15 5 64 5 85 7 24 7 51 8 9 8 12 8 21 8 23 8 26 8 30 8 38 8 69 9 19 9 34 9 45 10 37 10 43 10 50 10 53 11 18 11 25 11 27 11 84 12 77 13 14 13 17 13 20 13 29 13 32 13 47 13 78 14 16 15 28 17 61 18 22 18 90 19 31 20 41 20 46 21...
output:
57
result:
ok single line: '57'
Test #61:
score: 0
Accepted
time: 1ms
memory: 3584kb
input:
1 0
output:
1
result:
ok single line: '1'
Test #62:
score: 0
Accepted
time: 1ms
memory: 5560kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok single line: '1'