QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#783259 | #6261. Inquiry II | 353cerega# | AC ✓ | 247ms | 111320kb | C++14 | 2.7kb | 2024-11-26 04:15:48 | 2024-11-26 04:15:49 |
Judging History
answer
//#pragma GCC optimize("Ofast", "unroll-loops", "omit-frame-pointer","inline")
//#pragma GCC option("arch=native","tune=native","no-zero-upper")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define X first
#define Y second
const ll mod = 1000000007;
//const ll mod = 998244353;
ll pew(ll a, ll b) {
ll res = 1;
while (b>0) {
if (b&1) res = res*a%mod;
b >>= 1;
a = a*a%mod;
}
return res;
}
const int N = 111;
vector<int> g[N];
ll dp[N][1<<16][2];
int curmsk[N];
vector<int> was;
vector<pair<int,int>> E;
int k, k2;
void dfs(ll u, ll p) {
was[u] = 1;
for (ll v: g[u]) {
if (v==p) continue;
if (was[v]==1 and u<v) E.push_back({u,v});
if (was[v]==0) {
dfs(v,u);
}
}
}
void dfs2(ll u, ll p) {
was[u] = 1;
curmsk[u] = 0;
for (int i=0;i<E.size();i++) {
if (E[i].X==u or E[i].Y==u) curmsk[u] += (1<<i);
}
for (int i=0;i<(1<<k);i++) {
dp[u][i][0] = dp[u][i][1] = -mod;
}
dp[u][0][0] = 0, dp[u][curmsk[u]][1] = 1;
for (ll v: g[u]) {
if (v==p) continue;
if (was[v]==0) {
dfs2(v,u);
vector<vector<ll>> nxt(k2,vector<ll>(2,-mod));
int m1 = curmsk[v];
int m0 = curmsk[u];
int nxtmsk = m0^m1;
for (int l=m0;l>=0;l=(l-1)&m0) {
int m2 = m1&((1LL<<k)-1-l);
for (int r=m2;r>=0;r=(r-1)&m2) {
for (int b=0;b<2;b++) {
for (int b2=0;b2+b<2;b2++) {
nxt[(l|r)&nxtmsk][b] = max(nxt[(l|r)&nxtmsk][b],dp[u][l][b]+dp[v][r][b2]);
}
}
if (r==0) break;
}
if (l==0) break;
}
for (int i=0;i<k2;i++) {
dp[u][i][0] = nxt[i][0];
dp[u][i][1] = nxt[i][1];
}
curmsk[u] = nxtmsk;
}
}
}
void solve() {
ll n, m;
cin >> n >> m;
for (ll i=0;i<m;i++) {
ll u, v;
cin >> u >> v;
u--, v--;
g[u].push_back(v);
g[v].push_back(u);
}
was.resize(n);
dfs(0,-1);
sort(E.begin(),E.end());
E.resize(unique(E.begin(),E.end())-E.begin());
k = E.size();
k2 = (1<<k);
for (ll i=0;i<n;i++) was[i] = 0;
dfs2(0,-1);
cout << max(dp[0][0][0],dp[0][0][1]) << endl;
}
int main() {
ios_base::sync_with_stdio(false);
int T = 1;
//cin >> T;
while (T--) solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3572kb
input:
2 1 1 2
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 1ms
memory: 7760kb
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: 178ms
memory: 110144kb
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: 185ms
memory: 111228kb
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: 0ms
memory: 63428kb
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: 242ms
memory: 111320kb
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: 4ms
memory: 48656kb
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: 71160kb
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: 123ms
memory: 69288kb
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: 2ms
memory: 11824kb
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: 9748kb
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: 1ms
memory: 7660kb
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: 0ms
memory: 17972kb
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: 18ms
memory: 23392kb
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: 77ms
memory: 75732kb
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: 5616kb
input:
2 1 1 2
output:
1
result:
ok single line: '1'
Test #17:
score: 0
Accepted
time: 0ms
memory: 5916kb
input:
3 3 1 2 3 1 3 2
output:
1
result:
ok single line: '1'
Test #18:
score: 0
Accepted
time: 0ms
memory: 7720kb
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: 1ms
memory: 7672kb
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: 1ms
memory: 7752kb
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: 0ms
memory: 28236kb
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: 0ms
memory: 13804kb
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: 0ms
memory: 13860kb
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: 212ms
memory: 109280kb
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: 247ms
memory: 110392kb
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: 196ms
memory: 110808kb
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: 200ms
memory: 110044kb
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: 227ms
memory: 109344kb
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: 215ms
memory: 109964kb
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: 3ms
memory: 14160kb
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: 0ms
memory: 11756kb
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: 12052kb
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: 1ms
memory: 11760kb
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: 3ms
memory: 12376kb
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: 1ms
memory: 11768kb
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: 11804kb
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: 2ms
memory: 14092kb
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: 1ms
memory: 11768kb
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: 0ms
memory: 14160kb
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: 13812kb
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: 0ms
memory: 14112kb
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: 13876kb
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: 2ms
memory: 13800kb
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: 104ms
memory: 106380kb
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: 3ms
memory: 55052kb
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: 0ms
memory: 106028kb
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: 79ms
memory: 107444kb
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: 7ms
memory: 55080kb
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: 201ms
memory: 110020kb
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: 39ms
memory: 106584kb
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: 0ms
memory: 53196kb
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: 0ms
memory: 103924kb
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: 93ms
memory: 107824kb
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: 179ms
memory: 111036kb
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: 106004kb
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: 111ms
memory: 106472kb
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: 53ms
memory: 57172kb
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: 195ms
memory: 110644kb
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: 176ms
memory: 110492kb
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: 0ms
memory: 105964kb
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: 0ms
memory: 3624kb
input:
1 0
output:
1
result:
ok single line: '1'
Test #62:
score: 0
Accepted
time: 1ms
memory: 5672kb
input:
3 3 1 2 2 3 3 1
output:
1
result:
ok single line: '1'