QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#883569 | #10052. Just Long Neckties 2 | HuTao | 16 | 474ms | 32464kb | C++14 | 1.1kb | 2025-02-05 17:02:38 | 2025-02-05 17:02:40 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
namespace FastRead{
char buf[1 << 20 | 5], *s = buf, *t = buf;
#ifdef LOCAL
#define gc() getchar()
#else
#define gc() s == t && (t = (s = buf) + fread(buf, 1, 1 << 20, stdin), s == t) ? EOF : *s ++
#endif
template <typename T>
inline void Read(T &x)
{
x = 0;
char ch = gc();
while(ch < '0' || ch > '9') ch = gc();
while('0' <= ch && ch <= '9') x = (x * 10) + (ch ^ 48), ch = gc();
}
}
using FastRead::Read;
const int N = 5e6 + 5, M = 1 << 21 | 5;
int n, m;
int a[N];
int f[M];
int main()
{
Read(n);
for(int i = 1; i <= n; i ++ )
{
Read(a[i]);
m = max(m, a[i]);
a[i] -- ;
}
int ans = m;
for(int i = 0; i < 1 << m; i ++ )
{
int k = __builtin_popcount(i);
if(k >= ans) continue;
while(f[i] < n - 1 && (((i >> a[f[i] + 1]) | (i >> a[f[i] + 2])) & 1)) f[i] ++ ;
if(f[i] >= n - 1) ans = k;
for(int j = 1; j < m; j ++ )
f[(i ^ (1 << (j - 1))) | (1 << j)] = max(f[(i ^ (1 << (j - 1))) | (1 << j)], f[i]);
f[i | 1] = min(f[i | 1], f[i]);
}
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 9ms
memory: 10700kb
input:
15 2 19 3 6 1 18 20 9 17 19 18 4 15 7 16
output:
3
result:
ok single line: '3'
Test #2:
score: 10
Accepted
time: 2ms
memory: 8388kb
input:
15 13 6 13 10 3 6 18 8 20 14 11 15 12 12 15
output:
2
result:
ok single line: '2'
Test #3:
score: 10
Accepted
time: 0ms
memory: 8388kb
input:
15 3 6 7 9 10 6 12 13 5 13 14 16 17 6 18
output:
1
result:
ok single line: '1'
Test #4:
score: 10
Accepted
time: 2ms
memory: 5712kb
input:
13 14 2 12 4 16 5 7 7 19 8 5 8 20
output:
1
result:
ok single line: '1'
Test #5:
score: 10
Accepted
time: 9ms
memory: 7884kb
input:
15 6 14 13 5 17 16 15 6 20 17 9 21 10 4 20
output:
2
result:
ok single line: '2'
Test #6:
score: 10
Accepted
time: 29ms
memory: 15384kb
input:
15 21 21 21 14 13 16 15 14 7 6 5 3 7 5 1
output:
4
result:
ok single line: '4'
Test #7:
score: 10
Accepted
time: 31ms
memory: 12112kb
input:
15 5 15 16 17 21 21 21 21 21 13 21 21 21 1 21
output:
1
result:
ok single line: '1'
Test #8:
score: 10
Accepted
time: 0ms
memory: 7796kb
input:
15 8 8 8 8 8 8 8 8 8 8 8 8 8 8 14
output:
1
result:
ok single line: '1'
Test #9:
score: 10
Accepted
time: 0ms
memory: 8336kb
input:
15 17 17 17 6 6 17 17 17 6 17 6 17 6 6 17
output:
2
result:
ok single line: '2'
Test #10:
score: 10
Accepted
time: 0ms
memory: 5836kb
input:
15 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
output:
1
result:
ok single line: '1'
Test #11:
score: 10
Accepted
time: 25ms
memory: 15176kb
input:
15 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7
output:
7
result:
ok single line: '7'
Test #12:
score: 10
Accepted
time: 0ms
memory: 5836kb
input:
15 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8
output:
1
result:
ok single line: '1'
Test #13:
score: 10
Accepted
time: 60ms
memory: 15688kb
input:
15 21 21 20 20 19 19 18 18 17 17 16 16 15 15 14
output:
7
result:
ok single line: '7'
Test #14:
score: 10
Accepted
time: 30ms
memory: 15348kb
input:
2 21 21
output:
1
result:
ok single line: '1'
Test #15:
score: 10
Accepted
time: 29ms
memory: 12680kb
input:
15 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21
output:
1
result:
ok single line: '1'
Test #16:
score: 10
Accepted
time: 6ms
memory: 7376kb
input:
15 21 9 10 16 4 4 10 20 5 2 4 1 11 16 9
output:
3
result:
ok single line: '3'
Test #17:
score: 10
Accepted
time: 4ms
memory: 7680kb
input:
15 14 9 8 19 5 19 8 9 3 2 20 16 10 16 15
output:
3
result:
ok single line: '3'
Test #18:
score: 10
Accepted
time: 0ms
memory: 5836kb
input:
2 1 1
output:
1
result:
ok single line: '1'
Subtask #2:
score: 6
Accepted
Test #19:
score: 6
Accepted
time: 1ms
memory: 7880kb
input:
500 1 1 2 2 2 2 2 1 2 2 1 1 1 1 2 1 1 2 1 2 1 2 1 1 2 2 2 2 1 1 1 2 2 1 1 1 2 1 1 1 1 1 2 1 2 2 1 2 1 2 2 1 2 1 1 2 2 1 2 1 2 1 1 1 1 2 2 1 2 1 1 2 1 2 2 1 1 1 2 1 2 1 1 2 2 2 1 2 2 2 2 1 1 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 2 2 2 2 2 1 1 1 2 1 1 2 1 2 2 2 1 1 1 1 2 2 2 2 1 1 2 2 1 2 2 1 2 2 2 1 2 2 1 1 ...
output:
2
result:
ok single line: '2'
Test #20:
score: 6
Accepted
time: 0ms
memory: 5836kb
input:
500 1 2 1 1 2 2 1 2 1 1 2 1 2 1 1 1 1 2 2 1 1 2 2 2 1 1 1 1 2 2 1 2 1 2 2 2 1 1 2 2 2 1 1 1 1 2 1 1 2 1 1 2 2 1 2 2 1 1 1 1 2 2 2 2 1 1 2 1 2 2 2 2 2 1 2 2 1 1 2 1 2 2 1 1 1 2 1 2 1 2 1 2 1 1 1 2 2 1 1 1 1 2 2 2 2 1 1 1 1 1 2 1 2 2 2 2 1 2 1 2 2 1 1 1 2 2 1 1 1 2 2 1 2 2 2 1 1 1 2 2 1 1 2 2 2 2 1 1 ...
output:
2
result:
ok single line: '2'
Test #21:
score: 6
Accepted
time: 0ms
memory: 7876kb
input:
500 2 1 2 2 2 2 2 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 2 1 2 2 1 2 2 2 2 1 2 2 1 2 1 2 2 2 2 2 1 2 1 2 1 2 1 2 2 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 2 1 2 1 2 2 1 2 2 1 2 2 2 2 2 1 2 1 2 2 1 2 2 2 1 2 2 1 2 1 2 1 2 1 2 2 1 2 2 1 2 1 2 1 2 1 2 1 2 2 2 1 2 1 2 2 2 2 1 2 ...
output:
1
result:
ok single line: '1'
Test #22:
score: 6
Accepted
time: 0ms
memory: 5840kb
input:
500 2 1 2 1 2 1 1 2 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 1 2 1 1 2 1 2 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 1 1 2 ...
output:
1
result:
ok single line: '1'
Test #23:
score: 6
Accepted
time: 0ms
memory: 7876kb
input:
500 2 1 1 2 1 1 2 1 2 1 1 1 2 1 2 1 2 1 1 1 2 1 2 1 1 2 1 2 1 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 2 1 2 1 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 1 2 1 1 2 1 1 2 1 1 2 1 2 1 1 2 1 1 1 2 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 2 ...
output:
1
result:
ok single line: '1'
Test #24:
score: 6
Accepted
time: 0ms
memory: 8004kb
input:
500 2 1 2 1 2 1 2 1 1 1 2 1 2 1 1 1 1 1 1 2 1 1 1 1 2 1 2 1 1 1 1 1 2 1 1 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 1 1 1 2 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 1 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 1 1 2 1 2 1 2 1 2 1 1 2 1 1 1 1 2 1 1 1 ...
output:
1
result:
ok single line: '1'
Test #25:
score: 6
Accepted
time: 1ms
memory: 7880kb
input:
500 1 2 1 1 2 1 1 2 1 1 2 1 2 1 2 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 2 1 2 1 1 1 2 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 1 2 1 2 1 1 2 1 1 2 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 1 2 1 2 1 1 1 1 1 1 2 1 2 1 1 2 1 1 1 2 1 1 2 1 2 1 1 1 1 1 2 1 1 1 2 1 2 1 2 1 2 1 2 1 2 ...
output:
1
result:
ok single line: '1'
Test #26:
score: 6
Accepted
time: 1ms
memory: 5832kb
input:
2 1 2
output:
1
result:
ok single line: '1'
Test #27:
score: 6
Accepted
time: 0ms
memory: 5836kb
input:
2 2 1
output:
1
result:
ok single line: '1'
Test #28:
score: 6
Accepted
time: 0ms
memory: 5840kb
input:
4 1 1 2 2
output:
1
result:
ok single line: '1'
Test #29:
score: 6
Accepted
time: 0ms
memory: 7884kb
input:
4 2 2 1 1
output:
2
result:
ok single line: '2'
Test #30:
score: 6
Accepted
time: 0ms
memory: 7884kb
input:
500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
ok single line: '1'
Test #31:
score: 6
Accepted
time: 0ms
memory: 7880kb
input:
500 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
2
result:
ok single line: '2'
Test #32:
score: 6
Accepted
time: 0ms
memory: 5840kb
input:
2 2 2
output:
1
result:
ok single line: '1'
Test #33:
score: 6
Accepted
time: 0ms
memory: 5844kb
input:
500 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...
output:
1
result:
ok single line: '1'
Subtask #3:
score: 0
Wrong Answer
Test #34:
score: 12
Accepted
time: 0ms
memory: 7880kb
input:
500 2 5 4 4 4 1 1 4 5 1 1 2 2 1 4 3 3 1 4 5 4 3 1 1 3 4 4 2 2 3 1 1 1 1 3 3 5 2 1 2 1 1 4 1 4 4 1 2 2 5 3 4 2 3 2 3 5 3 3 1 5 3 4 5 1 2 5 5 2 1 5 1 4 2 2 2 1 2 1 2 2 1 4 2 3 5 1 2 5 2 1 2 5 3 3 5 3 1 3 4 3 3 1 3 4 4 5 1 2 2 2 3 2 5 3 5 3 1 4 5 1 1 5 3 3 5 4 3 1 5 1 5 5 1 5 5 2 4 3 2 5 3 3 2 4 3 1 3 ...
output:
5
result:
ok single line: '5'
Test #35:
score: 12
Accepted
time: 0ms
memory: 5840kb
input:
500 4 5 3 3 2 5 3 2 4 3 5 4 1 5 2 2 2 4 2 1 5 5 5 1 1 2 3 1 4 4 2 3 3 3 1 4 4 1 2 1 1 1 4 2 3 1 4 1 3 3 5 4 5 2 3 5 1 5 1 2 2 5 2 2 5 1 4 2 4 2 2 1 4 5 3 2 2 2 2 2 3 1 1 5 2 4 2 4 2 2 3 2 5 3 2 1 2 5 5 2 3 1 4 5 1 4 4 4 1 3 4 1 1 3 2 5 1 4 4 2 3 1 5 5 4 2 4 1 4 3 2 1 3 4 4 3 1 3 2 5 3 3 5 5 4 4 4 5 ...
output:
5
result:
ok single line: '5'
Test #36:
score: 12
Accepted
time: 1ms
memory: 5840kb
input:
500 1 1 4 1 1 3 1 1 3 1 5 1 1 1 5 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 3 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 3 1 1 1 1 4 1 1 2 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 4 1 3 1 1 1 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 4 2 2 1 2 2 2 2 2 2 5 2 2 1 2 3 2 2 1 2 2 2 2 2 5 2 2 1 ...
output:
1
result:
ok single line: '1'
Test #37:
score: 12
Accepted
time: 0ms
memory: 7880kb
input:
499 4 1 1 1 2 1 3 1 2 1 2 1 1 1 4 1 2 1 5 1 3 1 1 1 4 1 5 1 5 1 5 1 1 1 3 1 4 1 5 1 2 1 3 1 1 1 1 1 2 1 3 1 3 1 1 1 2 1 2 1 5 1 3 1 4 1 1 1 3 1 2 1 4 1 1 1 3 1 5 1 1 1 5 1 4 1 2 1 5 1 4 1 4 1 3 1 4 1 3 1 5 1 2 1 1 2 5 2 4 2 4 2 1 2 1 2 3 2 1 2 4 2 2 2 4 2 3 2 5 2 3 2 5 2 1 2 5 2 4 2 2 2 5 2 5 2 2 2 ...
output:
1
result:
ok single line: '1'
Test #38:
score: 0
Wrong Answer
time: 0ms
memory: 5840kb
input:
500 1 1 2 1 1 1 3 1 1 1 4 1 3 1 1 1 1 1 1 3 1 2 1 1 4 1 1 5 1 1 1 2 1 1 1 5 1 4 1 5 1 1 1 1 1 1 1 1 2 1 4 1 1 1 1 1 1 4 1 5 1 3 1 4 1 1 1 1 1 1 1 5 1 1 5 2 3 1 4 1 1 1 1 1 1 2 1 2 2 1 2 3 2 4 2 2 2 4 2 2 2 1 3 2 2 1 5 1 5 2 2 2 2 5 2 4 2 4 1 5 1 1 1 2 4 2 4 2 5 1 1 2 2 1 2 5 2 3 2 4 2 2 5 2 2 2 3 2 ...
output:
4
result:
wrong answer 1st lines differ - expected: '3', found: '4'
Subtask #4:
score: 0
Wrong Answer
Test #53:
score: 0
Wrong Answer
time: 1ms
memory: 8140kb
input:
500 2 1 12 3 13 13 7 9 7 3 14 10 9 13 6 3 9 1 10 10 7 13 6 9 10 13 3 7 15 12 14 4 1 5 4 3 8 7 3 14 5 1 6 13 1 3 4 10 5 8 3 6 2 4 10 1 13 5 6 13 12 10 14 15 8 9 13 10 9 14 4 9 13 12 4 7 12 4 2 14 6 12 5 4 6 12 13 6 2 12 10 5 6 5 1 1 5 1 5 12 11 3 6 13 11 10 1 8 14 9 5 5 15 1 15 3 15 10 4 6 9 14 1 5 1...
output:
11
result:
wrong answer 1st lines differ - expected: '10', found: '11'
Subtask #5:
score: 0
Wrong Answer
Test #73:
score: 26
Accepted
time: 3ms
memory: 9036kb
input:
500000 13 6 2 6 3 6 13 5 9 8 4 12 10 7 1 7 10 14 15 15 1 9 4 4 1 14 3 8 13 2 8 11 14 14 4 13 8 9 13 14 9 7 3 15 7 7 1 11 11 11 2 13 11 15 3 4 8 12 9 4 10 4 10 13 4 9 14 11 7 13 10 4 9 14 12 14 11 5 7 6 14 1 6 14 10 9 2 14 8 8 8 9 7 1 15 3 11 3 3 5 13 1 15 7 4 7 15 3 15 14 14 2 4 12 5 13 12 11 3 1 12...
output:
15
result:
ok single line: '15'
Test #74:
score: 26
Accepted
time: 4ms
memory: 9164kb
input:
500000 8 7 9 12 2 7 1 11 10 12 14 3 1 4 10 12 8 12 7 14 2 3 4 8 3 8 14 13 4 10 6 10 6 10 6 12 7 2 3 4 9 13 13 2 2 8 9 6 2 1 9 3 9 6 3 8 12 3 4 7 2 6 12 12 4 9 3 15 1 7 2 1 9 14 2 8 12 6 14 6 6 10 2 15 2 14 11 1 1 2 13 9 1 14 2 5 2 13 1 9 15 7 3 12 10 10 5 13 8 9 6 6 8 9 4 8 1 2 10 13 4 7 15 9 4 14 7...
output:
15
result:
ok single line: '15'
Test #75:
score: 26
Accepted
time: 2ms
memory: 10404kb
input:
500000 1 6 1 1 1 1 1 1 1 4 1 9 1 1 1 1 1 1 1 1 1 1 10 1 1 11 1 1 1 10 1 13 1 1 1 1 6 1 1 1 1 9 1 1 1 1 14 1 1 1 4 1 1 11 1 1 7 1 12 1 1 1 8 1 1 1 3 1 1 1 1 15 1 1 1 1 11 1 8 1 1 1 1 1 8 1 1 1 1 8 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 11 1 13 1 1 1 13 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 5 1 1 10 1 1 1 1 1 ...
output:
1
result:
ok single line: '1'
Test #76:
score: 26
Accepted
time: 4ms
memory: 9036kb
input:
499999 3 1 10 1 14 1 13 1 11 1 11 1 2 1 2 1 5 1 4 1 10 1 5 1 3 1 1 1 5 1 5 1 9 1 11 1 9 1 10 1 9 1 2 1 5 1 2 1 14 1 4 1 4 1 4 1 10 1 1 1 3 1 15 1 2 1 4 1 1 1 2 1 4 1 14 1 6 1 5 1 8 1 7 1 13 1 9 1 1 1 13 1 15 1 5 1 5 1 4 1 12 1 2 1 4 1 5 1 8 1 12 1 9 1 10 1 9 1 12 1 12 1 2 1 10 1 3 1 2 1 7 1 2 1 14 1...
output:
1
result:
ok single line: '1'
Test #77:
score: 0
Wrong Answer
time: 474ms
memory: 9040kb
input:
500000 1 1 1 9 1 1 3 1 1 2 1 1 1 1 1 1 1 13 1 12 1 4 1 3 1 12 1 8 1 1 12 1 1 1 6 1 6 1 15 1 11 1 1 1 13 1 1 8 1 1 1 1 5 1 6 1 1 14 1 13 1 5 1 6 1 1 1 1 1 8 1 12 1 8 1 13 1 8 1 1 1 7 1 12 1 1 1 5 1 12 1 3 1 2 1 5 1 8 1 1 1 12 1 13 1 13 1 1 12 1 8 1 9 1 1 14 1 10 1 12 1 14 1 1 1 8 1 3 1 1 1 1 1 10 1 1...
output:
15
result:
wrong answer 1st lines differ - expected: '2', found: '15'
Subtask #6:
score: 0
Time Limit Exceeded
Test #93:
score: 10
Accepted
time: 65ms
memory: 15820kb
input:
500000 18 13 10 17 5 21 13 19 14 14 11 5 11 21 9 15 1 12 4 17 10 18 14 10 1 14 8 15 6 10 7 13 17 12 7 2 11 20 12 8 13 21 3 1 1 5 15 8 9 14 15 15 12 12 15 7 21 12 1 8 7 20 2 1 12 18 4 4 17 1 1 6 12 6 21 12 7 11 17 5 5 19 7 21 21 16 13 17 5 16 19 14 3 3 5 4 15 2 21 12 20 21 1 2 16 15 5 17 12 4 11 19 1...
output:
21
result:
ok single line: '21'
Test #94:
score: 10
Accepted
time: 65ms
memory: 15560kb
input:
500000 3 14 11 18 13 6 14 19 1 3 13 2 11 10 21 7 17 20 5 7 7 9 10 8 7 5 2 10 19 12 5 16 21 15 15 1 9 21 5 18 2 20 9 2 5 21 12 15 9 9 17 9 13 8 18 11 16 16 19 5 18 9 3 1 1 3 15 3 6 17 3 2 20 3 1 10 15 20 16 4 2 1 4 19 8 6 7 10 3 10 11 21 10 8 21 14 6 4 4 11 9 21 4 10 21 13 16 6 10 2 15 17 11 21 10 6 ...
output:
21
result:
ok single line: '21'
Test #95:
score: 10
Accepted
time: 33ms
memory: 15944kb
input:
500000 1 1 1 14 1 1 14 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 12 1 1 1 1 1 1 1 1 1 5 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 17 1 3 1 1 1 1 13 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 19 1 5 1 1 11 1 1 1 1 1 15 1 16 1 1 1 8 1 1 17 1 1 1 20 1 1 1 1 1 1...
output:
1
result:
ok single line: '1'
Test #96:
score: 10
Accepted
time: 36ms
memory: 15304kb
input:
499999 7 1 12 1 5 1 16 1 16 1 7 1 1 1 13 1 12 1 12 1 9 1 6 1 7 1 12 1 8 1 4 1 18 1 21 1 5 1 21 1 10 1 19 1 16 1 6 1 9 1 17 1 17 1 5 1 5 1 17 1 19 1 1 1 2 1 4 1 20 1 14 1 4 1 12 1 9 1 11 1 9 1 2 1 1 1 17 1 16 1 14 1 15 1 8 1 4 1 15 1 21 1 11 1 16 1 13 1 14 1 8 1 8 1 2 1 9 1 9 1 19 1 17 1 17 1 21 1 8 ...
output:
1
result:
ok single line: '1'
Test #97:
score: 0
Time Limit Exceeded
input:
500000 18 1 1 1 14 1 1 5 1 15 1 5 1 8 1 12 1 13 1 17 1 1 1 7 1 17 1 15 1 3 1 1 12 1 11 1 7 1 18 1 8 1 14 1 1 16 1 18 1 20 1 8 1 1 12 1 1 11 1 16 1 21 1 5 1 1 1 1 1 4 1 14 1 8 1 8 1 1 5 1 6 1 2 1 7 1 2 1 1 1 1 1 21 1 20 1 19 1 6 1 6 1 1 3 1 13 1 1 1 21 1 2 1 17 1 1 3 1 6 1 2 1 13 1 1 6 1 20 1 16 1 9 ...
output:
result:
Subtask #7:
score: 0
Time Limit Exceeded
Test #122:
score: 18
Accepted
time: 101ms
memory: 32464kb
input:
5000000 13 18 3 21 9 14 1 14 7 16 2 17 21 12 14 1 1 15 15 18 18 16 19 18 2 3 13 5 14 14 13 3 2 9 3 20 7 17 16 14 13 8 21 12 6 3 6 13 2 19 3 5 14 21 3 11 21 10 12 14 3 13 21 13 1 8 8 16 9 10 17 5 17 3 11 10 2 9 15 11 15 13 10 12 6 8 16 21 11 9 15 17 18 1 20 14 16 3 18 5 5 6 12 16 6 7 5 16 11 11 18 16...
output:
21
result:
ok single line: '21'
Test #123:
score: 18
Accepted
time: 103ms
memory: 32432kb
input:
5000000 5 21 15 12 8 17 15 17 10 15 1 1 2 9 17 3 14 6 7 5 16 19 12 7 7 14 18 15 14 9 13 3 20 4 2 8 14 8 10 5 4 20 10 7 17 12 2 21 2 19 7 10 17 7 13 12 18 19 17 7 2 6 1 19 12 6 13 16 1 12 19 14 5 3 20 1 7 4 16 6 10 14 5 6 15 6 9 6 9 21 21 21 19 8 1 13 9 19 4 20 5 10 21 16 12 21 9 8 13 2 16 16 19 8 20...
output:
21
result:
ok single line: '21'
Test #124:
score: 18
Accepted
time: 65ms
memory: 32460kb
input:
5000000 1 1 1 1 1 1 9 1 1 7 1 8 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 11 1 1 1 1 1 1 1 17 1 14 1 1 1 4 1 1 1 11 1 1 20 1 14 1 1 1 1 1 1 1 6 1 1 1 1 1 21 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 8 1 1 1 1 1 1 19 1 1 1 1 1 1 1 1 1 1 1 1 1 3 1 1 1 15 1 1 11 1 1 1 7 1 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
ok single line: '1'
Test #125:
score: 18
Accepted
time: 67ms
memory: 32412kb
input:
4999999 7 1 12 1 20 1 9 1 10 1 3 1 7 1 21 1 14 1 21 1 20 1 4 1 12 1 21 1 21 1 3 1 11 1 20 1 10 1 7 1 11 1 20 1 4 1 18 1 7 1 13 1 15 1 14 1 6 1 8 1 3 1 10 1 7 1 16 1 16 1 11 1 8 1 9 1 15 1 12 1 6 1 14 1 3 1 12 1 16 1 14 1 7 1 9 1 9 1 1 1 19 1 11 1 17 1 16 1 18 1 17 1 9 1 2 1 15 1 14 1 18 1 10 1 14 1 ...
output:
1
result:
ok single line: '1'
Test #126:
score: 0
Time Limit Exceeded
input:
5000000 18 1 8 1 1 1 20 1 10 1 1 1 1 21 1 17 1 1 15 1 14 1 1 1 1 9 1 2 1 8 1 10 1 4 1 14 1 1 1 14 1 9 1 11 1 4 1 5 1 1 1 1 11 1 13 1 1 14 1 1 1 2 1 7 1 1 1 1 1 1 1 2 1 1 4 1 15 1 1 1 19 1 12 1 19 1 1 2 1 18 1 11 1 1 14 1 15 1 4 1 9 1 13 1 8 1 21 1 2 1 14 1 1 4 1 10 1 1 1 1 5 1 14 1 20 1 3 1 5 1 21 1...