QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#882439 | #10052. Just Long Neckties 2 | bulijiojiodibuliduo | 100 ✓ | 458ms | 616248kb | C++17 | 5.4kb | 2025-02-05 02:36:19 | 2025-02-05 02:36:29 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head
namespace fastIO{
#define BUF_SIZE 1000000
#define ll long long
//fread->read
bool IOerror=0;
inline char nc(){
static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
if (p1==pend){
p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
if (pend==p1){IOerror=1;return -1;}
//{printf("IO error!\n");system("pause");for (;;);exit(0);}
}
return *p1++;
}
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
inline void read(int &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=1,ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
if (sign)x=-x;
}
inline void read(ll &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=1,ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
if (sign)x=-x;
}
inline void read(double &x){
bool sign=0; char ch=nc(); x=0;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=1,ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
if (ch=='.'){
double tmp=1; ch=nc();
for (;ch>='0'&&ch<='9';ch=nc())tmp/=10.0,x+=tmp*(ch-'0');
}
if (sign)x=-x;
}
inline void read(char *s){
char ch=nc();
for (;blank(ch);ch=nc());
if (IOerror)return;
for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
*s=0;
}
inline void read(char &c){
for (c=nc();blank(c);c=nc());
if (IOerror){c=-1;return;}
}
//getchar->read
inline void read1(int &x){
char ch;int bo=0;x=0;
for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1;
for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
if (bo)x=-x;
}
inline void read1(ll &x){
char ch;int bo=0;x=0;
for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1;
for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
if (bo)x=-x;
}
inline void read1(double &x){
char ch;int bo=0;x=0;
for (ch=getchar();ch<'0'||ch>'9';ch=getchar())if (ch=='-')bo=1;
for (;ch>='0'&&ch<='9';x=x*10+ch-'0',ch=getchar());
if (ch=='.'){
double tmp=1;
for (ch=getchar();ch>='0'&&ch<='9';tmp/=10.0,x+=tmp*(ch-'0'),ch=getchar());
}
if (bo)x=-x;
}
inline void read1(char *s){
char ch=getchar();
for (;blank(ch);ch=getchar());
for (;!blank(ch);ch=getchar())*s++=ch;
*s=0;
}
inline void read1(char &c){for (c=getchar();blank(c);c=getchar());}
//scanf->read
inline void read2(int &x){scanf("%d",&x);}
inline void read2(ll &x){
#ifdef _WIN32
scanf("%I64d",&x);
#else
#ifdef __linux
scanf("%lld",&x);
#else
puts("error:can't recognize the system!");
#endif
#endif
}
inline void read2(double &x){scanf("%lf",&x);}
inline void read2(char *s){scanf("%s",s);}
inline void read2(char &c){scanf(" %c",&c);}
#undef BUF_SIZE
};
using namespace fastIO;
#define bit(x) (1<<(x))
#define F(j,x) (((j)>>(x))&1)
typedef pair<ll,ll> PLL;
const int N=5010000;
const int M=21;
const int inf=1<<30;
int n,a[N],ans=inf,bo[33];
int dis[(1<<M)+10];
int trans(int u,int b) {
assert(!(u&bit(b)));
int w=u&((1<<b)-1);
if (w==0) return u^(1<<b);
u^=1<<(31-__builtin_clz(w));
return u^(1<<b);
}
const int B=50;
int nxt[N/B][M][M];
int pre[N][M];
int main() {
read(n);
rep(i,0,n) {
//scanf("%d",&a[i]);
read(a[i]);
a[i]--;
}
dis[0]=-1;
rep(i,1,1<<M) {
dis[i]=-2;
}
int tB=(n-2)/B;
rep(i,0,M) rep(j,i,M) nxt[tB+1][i][j]=tB+1;
for (int i=tB;i>=0;i--) {
int l=i*B,r=min(i*B+B-1,n-2);
rep(x,0,M) rep(y,x,M) nxt[i][x][y]=nxt[i+1][x][y];
for (int j=l;j<=r;j++) {
int u=a[j],v=a[j+1];
if (u>v) swap(u,v);
nxt[i][u][v]=i;
}
}
rep(i,0,n) {
if (i==0) {
rep(j,0,M) pre[i][j]=-1;
} else {
rep(j,0,M) pre[i][j]=pre[i-1][j];
}
pre[i][a[i]]=i;
}
rep(u,0,1<<M) if (dis[u]!=-2) {
int w=dis[u];
auto upd=[&](int x,int y) {
dis[x]=max(dis[x],y);
};
int pt=0;
rep(i,0,M) if (!(u&(1<<i))) bo[pt++]=i;
int vv=tB+1,zz=w/B+1;
rep(i,0,pt) rep(j,i,pt) vv=min(vv,nxt[zz][bo[i]][bo[j]]);
int nv=n;
if (vv<=tB) {
int l=vv*B,r=min(vv*B+B-1,n-2);
for (int j=l;j<=r;j++) if (!F(u,a[j])&&!F(u,a[j+1])) {
nv=j;
break;
}
}
int r=min((w/B)*B+B-1,n-2);
for (int j=w+1;j<=r;j++) if (!F(u,a[j])&&!F(u,a[j+1])) {
nv=j;
break;
}
if (nv>=n) {
ans=min(ans,__builtin_popcount(u));
continue;
}
upd(trans(u,a[nv+1]),nv+1);
rep(i,0,pt) {
int o=pre[nv][bo[i]];
if (o>=w+1) upd(trans(u,bo[i]),o);
}
/*rep(j,w+1,nv+1) {
if (u&bit(a[j])) continue;
upd(trans(u,a[j]),j);
}*/
}
printf("%d\n",ans);
}
詳細信息
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 5ms
memory: 16208kb
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: 5ms
memory: 18124kb
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: 7ms
memory: 18088kb
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: 5ms
memory: 16208kb
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: 4ms
memory: 18256kb
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: 5ms
memory: 18124kb
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: 5ms
memory: 16000kb
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: 4ms
memory: 18124kb
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: 6ms
memory: 18252kb
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: 5ms
memory: 18252kb
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: 5ms
memory: 16084kb
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: 5ms
memory: 16216kb
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: 5ms
memory: 16216kb
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: 5ms
memory: 16208kb
input:
2 21 21
output:
1
result:
ok single line: '1'
Test #15:
score: 10
Accepted
time: 4ms
memory: 16212kb
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: 18128kb
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: 16216kb
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: 5ms
memory: 18080kb
input:
2 1 1
output:
1
result:
ok single line: '1'
Subtask #2:
score: 6
Accepted
Test #19:
score: 6
Accepted
time: 7ms
memory: 16212kb
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: 5ms
memory: 18252kb
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: 7ms
memory: 16212kb
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: 6ms
memory: 18128kb
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: 6ms
memory: 16088kb
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: 5ms
memory: 18128kb
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: 6ms
memory: 18128kb
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: 6ms
memory: 16088kb
input:
2 1 2
output:
1
result:
ok single line: '1'
Test #27:
score: 6
Accepted
time: 5ms
memory: 16084kb
input:
2 2 1
output:
1
result:
ok single line: '1'
Test #28:
score: 6
Accepted
time: 5ms
memory: 18252kb
input:
4 1 1 2 2
output:
1
result:
ok single line: '1'
Test #29:
score: 6
Accepted
time: 5ms
memory: 16212kb
input:
4 2 2 1 1
output:
2
result:
ok single line: '2'
Test #30:
score: 6
Accepted
time: 7ms
memory: 16216kb
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: 5ms
memory: 18252kb
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: 6ms
memory: 16084kb
input:
2 2 2
output:
1
result:
ok single line: '1'
Test #33:
score: 6
Accepted
time: 5ms
memory: 16084kb
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: 12
Accepted
Test #34:
score: 12
Accepted
time: 6ms
memory: 16084kb
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: 5ms
memory: 16048kb
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: 5ms
memory: 16084kb
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: 6ms
memory: 16196kb
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: 12
Accepted
time: 7ms
memory: 16040kb
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:
3
result:
ok single line: '3'
Test #39:
score: 12
Accepted
time: 8ms
memory: 16084kb
input:
500 5 4 5 5 5 5 5 5 4 4 5 5 4 5 4 4 5 5 5 5 5 5 5 5 5 4 5 5 5 4 5 5 4 5 4 5 4 4 5 5 5 4 5 4 5 5 5 4 5 5 5 4 5 5 5 5 4 5 4 4 4 5 4 5 5 5 5 5 4 5 5 5 5 5 5 5 4 5 4 4 4 4 5 5 5 5 5 4 5 4 5 5 4 5 5 5 5 5 4 5 5 5 3 3 3 3 5 5 3 5 3 4 3 4 4 3 4 3 5 5 5 4 3 4 4 4 5 3 3 4 4 5 3 5 3 5 3 4 4 5 5 3 5 4 3 3 5 4 ...
output:
5
result:
ok single line: '5'
Test #40:
score: 12
Accepted
time: 6ms
memory: 18256kb
input:
500 4 4 1 4 5 4 4 4 2 4 4 4 3 5 5 5 5 4 4 1 1 1 5 3 5 4 4 5 4 4 5 2 4 2 1 1 4 2 5 2 4 4 5 4 1 4 5 4 4 4 4 4 4 4 2 4 5 1 2 5 1 2 4 5 3 3 1 3 4 3 4 1 3 2 2 4 4 3 4 2 1 5 2 3 4 4 4 4 5 3 4 5 5 1 4 1 4 1 4 4 4 2 4 3 2 3 5 1 4 3 1 4 1 3 4 5 2 4 2 1 3 4 1 4 4 4 1 4 2 4 4 5 2 4 5 4 5 4 4 4 4 4 2 4 5 4 4 2 ...
output:
5
result:
ok single line: '5'
Test #41:
score: 12
Accepted
time: 6ms
memory: 16084kb
input:
500 1 4 1 1 1 1 1 1 1 1 1 3 1 1 1 3 1 1 1 1 1 1 3 1 1 4 1 1 1 2 4 1 3 1 5 1 1 1 1 1 2 1 1 1 1 5 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 5 3 2 1 5 5 1 2 1 1 1 4 1 1 1 1 1 1 5 5 1 1 1 1 5 2 1 1 2 5 3 1 1 1 1 3 1 1 1 2 1 1 2 1 1 1 1 1 2 1 1 1 2 1 3 1 2 1 1 1 1 1 1 1 3 4 3 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 3 1 1 1 ...
output:
4
result:
ok single line: '4'
Test #42:
score: 12
Accepted
time: 5ms
memory: 18120kb
input:
500 5 5 5 1 1 2 5 5 1 5 5 1 1 5 1 5 5 1 5 1 5 1 1 1 3 5 1 1 1 5 5 1 5 5 4 5 3 1 1 1 5 1 5 5 3 1 1 1 5 1 5 1 2 5 5 5 3 5 1 1 1 5 1 1 1 5 1 5 1 3 4 5 5 1 5 1 1 5 2 1 5 1 1 3 5 5 5 1 5 1 5 1 1 1 4 1 1 5 1 1 1 1 1 5 1 5 5 5 5 1 1 5 1 5 1 5 1 5 1 1 5 5 1 1 1 5 3 5 1 1 5 1 1 5 1 5 1 1 5 5 5 1 1 1 5 5 1 1 ...
output:
4
result:
ok single line: '4'
Test #43:
score: 12
Accepted
time: 6ms
memory: 18248kb
input:
5 1 2 3 4 5
output:
1
result:
ok single line: '1'
Test #44:
score: 12
Accepted
time: 5ms
memory: 16176kb
input:
5 5 4 3 2 1
output:
2
result:
ok single line: '2'
Test #45:
score: 12
Accepted
time: 5ms
memory: 16212kb
input:
10 1 1 2 2 3 3 4 4 5 5
output:
1
result:
ok single line: '1'
Test #46:
score: 12
Accepted
time: 7ms
memory: 18128kb
input:
10 5 5 4 4 3 3 2 2 1 1
output:
5
result:
ok single line: '5'
Test #47:
score: 12
Accepted
time: 6ms
memory: 18252kb
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 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'
Test #48:
score: 12
Accepted
time: 6ms
memory: 16080kb
input:
500 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 ...
output:
5
result:
ok single line: '5'
Test #49:
score: 12
Accepted
time: 6ms
memory: 16084kb
input:
2 5 5
output:
1
result:
ok single line: '1'
Test #50:
score: 12
Accepted
time: 4ms
memory: 18252kb
input:
500 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
1
result:
ok single line: '1'
Test #51:
score: 12
Accepted
time: 4ms
memory: 16216kb
input:
500 1 1 3 1 3 1 3 1 3 1 2 1 2 1 5 1 3 1 4 1 2 1 3 2 5 1 2 2 4 2 3 1 2 1 1 1 3 1 5 1 1 1 4 1 5 1 4 1 5 2 3 1 3 1 1 1 3 2 5 2 5 1 1 1 1 1 2 4 2 4 3 5 1 3 2 4 2 3 2 3 2 3 1 3 1 2 2 2 1 2 3 1 2 5 1 2 2 1 2 3 2 3 1 3 2 2 3 1 2 5 2 4 1 2 2 4 2 3 1 3 3 1 2 3 1 2 2 4 2 1 2 3 2 5 3 1 3 4 4 2 3 3 3 5 2 5 3 4 ...
output:
4
result:
ok single line: '4'
Test #52:
score: 12
Accepted
time: 5ms
memory: 16084kb
input:
500 1 1 1 1 2 1 5 1 4 1 1 1 1 1 4 1 2 1 5 1 5 1 2 1 1 1 2 1 4 2 1 1 4 1 2 1 3 1 2 1 2 1 1 2 5 1 5 2 2 1 3 1 3 1 3 1 1 1 1 1 4 1 1 1 4 1 2 1 3 1 1 1 1 1 1 2 4 2 1 2 4 2 5 1 5 1 5 1 2 1 5 1 5 1 1 1 2 1 4 1 5 2 4 1 1 1 3 2 4 1 3 1 4 1 2 2 2 2 2 1 4 2 1 2 1 2 2 3 1 4 4 2 3 3 4 2 2 3 5 2 5 2 1 2 1 2 4 1 ...
output:
4
result:
ok single line: '4'
Subtask #4:
score: 18
Accepted
Test #53:
score: 18
Accepted
time: 9ms
memory: 18252kb
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:
10
result:
ok single line: '10'
Test #54:
score: 18
Accepted
time: 8ms
memory: 16084kb
input:
500 13 14 8 6 9 11 5 12 9 13 10 11 2 3 7 15 12 1 11 3 1 10 15 6 4 9 2 10 3 5 3 14 4 12 11 11 4 7 8 4 13 10 6 2 11 15 2 10 12 4 13 5 2 5 2 15 3 14 9 7 1 6 12 15 10 5 6 5 4 7 13 1 12 15 2 15 11 10 15 8 5 12 2 14 11 4 1 12 5 10 13 14 10 10 7 12 10 8 11 13 12 2 11 10 1 14 1 10 6 13 13 7 5 14 3 8 4 10 6 ...
output:
11
result:
ok single line: '11'
Test #55:
score: 18
Accepted
time: 5ms
memory: 18124kb
input:
500 1 7 1 1 1 9 1 8 1 13 1 1 8 1 1 6 1 1 10 1 7 1 1 1 1 15 1 2 1 8 1 2 1 2 2 2 8 2 4 2 2 2 2 6 2 2 2 2 2 2 2 2 2 10 2 2 2 2 2 14 2 2 2 2 9 2 2 6 2 3 3 11 3 3 10 3 3 3 3 3 3 3 1 3 3 3 3 3 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3 9 3 12 3 1 4 7 4 4 4 4 4 6 4 4 4 12 4 4 5 4 4 4 4 4 4 4 4 4 4 13 4 5 4 5 ...
output:
1
result:
ok single line: '1'
Test #56:
score: 18
Accepted
time: 5ms
memory: 16212kb
input:
499 9 1 6 1 14 1 8 1 4 1 15 1 11 1 7 1 12 1 2 1 4 1 6 1 2 1 15 1 1 1 5 1 13 1 5 1 2 1 15 1 5 2 5 2 9 2 15 2 2 2 3 2 5 2 13 2 9 2 7 2 13 2 11 2 11 3 13 3 15 3 1 3 8 3 1 3 12 3 3 3 12 3 14 3 6 3 9 3 1 3 14 3 8 4 11 4 3 4 5 4 15 4 9 4 9 4 13 4 4 4 8 4 4 4 1 4 6 4 3 4 13 4 14 4 1 4 15 5 7 5 2 5 12 5 15 ...
output:
1
result:
ok single line: '1'
Test #57:
score: 18
Accepted
time: 10ms
memory: 18252kb
input:
500 6 1 7 1 1 2 2 10 2 1 1 1 14 2 9 1 1 12 2 8 2 1 1 14 3 5 1 2 2 12 3 8 1 1 3 3 2 13 4 2 1 11 1 13 2 1 4 3 2 2 12 1 2 12 3 12 2 4 10 1 10 2 9 2 11 2 2 2 9 2 1 2 4 3 15 2 3 14 3 2 2 7 4 3 11 2 9 3 9 3 4 13 3 7 3 11 3 3 4 6 5 3 5 15 3 3 4 3 2 4 4 4 3 4 14 4 6 3 4 5 5 4 4 4 3 5 6 4 6 5 4 6 5 15 5 11 4...
output:
4
result:
ok single line: '4'
Test #58:
score: 18
Accepted
time: 9ms
memory: 18124kb
input:
500 4 10 1 3 2 3 12 1 6 4 5 2 1 3 2 11 7 11 1 2 2 13 2 2 4 3 5 4 5 1 6 4 6 1 10 4 2 4 1 15 6 5 5 8 7 1 1 1 7 6 9 4 9 7 8 11 2 15 13 1 1 1 5 9 4 7 3 7 6 6 6 4 11 1 3 7 5 6 9 15 3 6 1 8 15 4 9 7 7 1 2 3 2 4 4 3 9 1 4 8 10 9 4 7 11 2 1 1 9 1 2 1 10 3 6 7 14 2 1 1 1 2 5 4 2 4 7 8 8 2 9 9 8 4 4 14 6 9 1 ...
output:
8
result:
ok single line: '8'
Test #59:
score: 18
Accepted
time: 9ms
memory: 16212kb
input:
500 12 14 3 10 7 6 9 5 3 5 4 3 11 4 5 2 4 11 11 2 10 1 2 5 4 9 12 9 10 8 2 6 3 2 5 6 8 8 5 6 8 4 15 5 2 13 2 6 7 4 6 6 8 3 7 5 12 4 9 2 14 8 11 4 11 2 9 2 2 6 1 2 8 5 3 4 1 9 12 6 1 9 10 4 10 14 6 3 2 11 9 3 4 10 12 12 11 14 15 1 1 10 4 4 3 12 1 12 9 3 4 13 7 5 11 5 9 2 13 14 8 2 4 6 9 7 11 9 2 12 1...
output:
9
result:
ok single line: '9'
Test #60:
score: 18
Accepted
time: 9ms
memory: 18120kb
input:
500 9 5 6 3 6 1 8 3 8 1 4 3 9 2 10 3 10 1 9 4 9 2 7 7 12 6 1 2 2 3 14 5 1 1 8 3 11 9 6 2 15 4 15 1 7 8 15 2 9 6 2 1 8 9 7 3 10 7 2 10 12 8 8 8 11 2 11 4 3 4 6 1 4 3 9 14 2 2 13 6 5 2 14 7 5 1 3 7 12 1 1 5 13 4 14 10 15 13 6 12 1 2 2 7 2 9 12 3 3 4 8 10 1 6 1 7 2 10 3 6 4 4 11 10 13 7 7 11 2 15 8 3 1...
output:
8
result:
ok single line: '8'
Test #61:
score: 18
Accepted
time: 10ms
memory: 16212kb
input:
500 10 15 4 2 4 11 1 12 6 5 1 13 13 1 9 1 10 1 4 9 7 15 7 13 7 3 14 1 13 14 1 15 9 13 10 8 15 4 8 12 7 9 7 14 10 15 11 5 14 12 14 1 13 10 3 14 15 5 4 6 6 11 9 7 10 6 8 7 4 4 2 10 6 1 15 7 2 15 7 14 11 3 9 7 5 9 4 6 11 7 1 15 10 10 6 5 8 3 8 12 5 9 1 9 2 9 2 1 5 9 6 9 7 1 5 13 3 2 9 3 6 6 5 5 1 6 14 ...
output:
10
result:
ok single line: '10'
Test #62:
score: 18
Accepted
time: 6ms
memory: 18124kb
input:
500 15 15 14 15 15 15 14 13 15 15 13 13 13 15 15 15 15 15 15 14 15 15 15 15 15 14 15 15 15 15 15 13 15 13 15 14 15 15 13 13 12 13 15 12 15 14 13 13 15 15 14 12 15 13 12 15 14 15 12 14 14 15 12 15 13 12 13 12 12 12 13 12 14 15 15 14 13 13 13 12 11 13 13 12 15 15 11 14 12 13 11 15 13 12 13 13 11 11 15...
output:
14
result:
ok single line: '14'
Test #63:
score: 18
Accepted
time: 7ms
memory: 16084kb
input:
500 15 1 9 8 1 6 7 9 9 9 9 9 9 9 13 13 9 9 10 9 9 9 9 9 9 11 9 9 12 6 15 9 12 4 6 9 9 2 9 12 8 9 9 9 1 9 12 9 15 13 5 1 9 15 9 8 9 1 14 11 14 9 14 9 9 9 11 7 9 9 2 10 9 5 11 8 9 9 4 9 9 9 9 9 8 9 1 9 2 8 9 14 2 8 9 9 4 9 1 4 1 9 9 8 3 5 9 11 9 9 9 9 9 9 8 1 9 9 9 1 9 9 11 12 15 9 9 9 10 3 9 9 9 9 9 ...
output:
8
result:
ok single line: '8'
Test #64:
score: 18
Accepted
time: 7ms
memory: 18120kb
input:
500 8 3 15 8 8 15 8 8 8 8 8 3 3 8 8 8 4 8 8 8 4 8 8 8 15 8 8 8 8 8 8 8 8 8 8 1 8 8 8 8 8 8 8 8 8 8 8 6 8 8 8 8 8 8 8 8 8 8 8 8 8 15 8 3 8 8 8 8 8 8 8 10 8 14 8 8 8 6 2 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 10 11 8 8 8 4 8 2 8 8 8 8 8 8 8 8 8 8 8 14 8 8 8 8 3 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 8 15 8 ...
output:
4
result:
ok single line: '4'
Test #65:
score: 18
Accepted
time: 6ms
memory: 18256kb
input:
500 6 3 5 6 3 6 6 6 3 6 6 3 3 6 6 3 4 6 6 3 3 3 3 6 14 6 3 3 6 6 6 3 6 3 6 6 3 6 3 6 3 6 3 11 6 3 3 6 5 10 15 3 6 3 6 6 6 6 6 3 3 3 3 3 3 6 6 6 6 3 3 12 6 3 3 6 6 6 6 3 6 3 6 3 3 6 6 3 5 3 3 3 3 6 4 6 6 6 6 6 3 6 6 6 3 3 3 3 3 3 3 3 6 3 2 6 3 3 6 3 3 6 3 3 6 3 3 6 6 6 6 3 3 15 9 3 6 3 6 6 3 6 3 3 3 ...
output:
4
result:
ok single line: '4'
Test #66:
score: 18
Accepted
time: 5ms
memory: 18256kb
input:
15 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
output:
7
result:
ok single line: '7'
Test #67:
score: 18
Accepted
time: 5ms
memory: 18252kb
input:
30 1 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
output:
1
result:
ok single line: '1'
Test #68:
score: 18
Accepted
time: 5ms
memory: 18252kb
input:
30 15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1
output:
15
result:
ok single line: '15'
Test #69:
score: 18
Accepted
time: 7ms
memory: 18128kb
input:
495 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
1
result:
ok single line: '1'
Test #70:
score: 18
Accepted
time: 5ms
memory: 18216kb
input:
495 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13...
output:
15
result:
ok single line: '15'
Test #71:
score: 18
Accepted
time: 5ms
memory: 18256kb
input:
2 15 15
output:
1
result:
ok single line: '1'
Test #72:
score: 18
Accepted
time: 5ms
memory: 16088kb
input:
500 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
1
result:
ok single line: '1'
Subtask #5:
score: 26
Accepted
Test #73:
score: 26
Accepted
time: 19ms
memory: 76704kb
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: 21ms
memory: 81716kb
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: 16ms
memory: 79668kb
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: 23ms
memory: 81584kb
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: 26
Accepted
time: 22ms
memory: 79668kb
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:
2
result:
ok single line: '2'
Test #78:
score: 26
Accepted
time: 22ms
memory: 77328kb
input:
500000 1 1 1 1 1 1 9 1 1 6 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 10 1 1 1 12 1 1 1 1 6 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 11 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 2 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 6 1 1 1 1 1 1 1 1 1 1 1 ...
output:
10
result:
ok single line: '10'
Test #79:
score: 26
Accepted
time: 24ms
memory: 76860kb
input:
500000 9 2 2 1 9 1 12 1 5 1 15 2 4 1 1 1 14 1 11 1 11 1 11 1 9 1 6 1 13 1 4 1 9 1 5 1 9 1 14 1 1 2 10 1 8 1 2 1 9 1 5 1 6 1 3 1 15 1 2 1 8 2 4 1 3 1 2 1 2 1 5 2 14 1 1 1 7 1 4 1 6 1 5 1 8 1 14 1 12 1 9 1 8 1 11 1 8 2 8 1 8 1 3 1 14 1 9 1 12 1 12 1 12 1 11 1 13 1 3 1 6 1 4 1 3 1 5 1 10 1 8 1 8 2 7 2 ...
output:
13
result:
ok single line: '13'
Test #80:
score: 26
Accepted
time: 22ms
memory: 79540kb
input:
500000 4 1 8 1 2 1 11 1 9 1 3 1 14 2 1 1 9 1 11 1 4 1 13 1 8 1 15 1 8 1 13 1 15 1 12 1 9 1 12 1 13 1 1 1 11 1 8 1 14 1 8 1 14 1 5 1 6 1 4 1 5 1 7 1 3 1 9 1 5 1 15 1 1 1 12 1 2 1 9 1 3 1 11 1 4 1 5 1 14 1 14 1 9 1 2 1 8 1 9 1 7 1 8 1 2 1 14 1 8 1 11 1 6 1 15 1 4 1 2 1 12 1 9 1 15 1 5 1 6 1 1 1 2 1 14...
output:
10
result:
ok single line: '10'
Test #81:
score: 26
Accepted
time: 24ms
memory: 77036kb
input:
500000 14 2 8 1 1 1 8 1 3 1 11 1 15 1 11 2 7 2 11 1 15 1 11 1 1 2 11 1 10 1 10 1 5 1 12 1 2 1 2 3 2 1 6 1 9 1 7 1 8 1 8 1 4 2 8 3 14 1 6 1 6 1 9 1 7 1 5 2 2 1 13 1 6 1 5 4 12 3 5 1 3 1 5 1 6 1 8 1 13 1 11 1 13 1 3 1 4 2 1 1 12 2 12 2 7 1 2 1 4 1 12 1 11 2 6 3 6 1 11 1 10 1 6 1 4 1 3 1 3 1 11 1 3 1 4...
output:
15
result:
ok single line: '15'
Test #82:
score: 26
Accepted
time: 16ms
memory: 81716kb
input:
500000 15 15 15 14 13 15 15 15 15 15 13 15 15 15 15 15 14 15 14 15 15 13 15 15 14 15 13 15 15 15 14 15 13 13 15 14 15 15 15 15 14 15 15 14 13 15 15 15 15 15 15 13 15 14 14 15 13 15 15 15 15 15 15 13 14 15 15 15 15 13 14 13 15 14 14 15 15 15 15 13 14 15 15 14 15 15 15 13 15 15 15 13 13 14 15 15 14 15...
output:
15
result:
ok single line: '15'
Test #83:
score: 26
Accepted
time: 22ms
memory: 81716kb
input:
500000 8 7 11 7 7 6 7 13 7 11 2 7 7 7 11 15 13 11 9 3 4 5 7 7 9 11 7 7 5 4 8 7 7 7 7 2 12 13 5 1 4 4 7 7 4 14 5 7 7 7 6 4 1 8 10 13 7 7 7 7 15 7 9 6 4 9 15 7 5 7 3 7 7 4 7 7 11 6 8 6 7 7 7 7 3 7 1 10 2 7 6 7 11 7 7 8 4 5 15 11 7 15 7 7 11 2 9 7 14 7 6 7 7 1 4 7 14 6 7 7 1 2 1 7 7 13 7 1 7 6 15 7 9 6...
output:
15
result:
ok single line: '15'
Test #84:
score: 26
Accepted
time: 18ms
memory: 79540kb
input:
500000 2 2 2 2 4 2 2 2 1 1 2 2 2 2 2 2 6 2 10 11 2 10 2 2 2 2 2 11 2 2 11 15 2 2 2 5 2 7 2 2 2 2 10 2 12 2 2 2 2 2 2 2 2 2 2 2 2 2 2 11 2 2 2 2 9 2 2 2 15 2 1 2 2 2 2 2 2 2 2 5 3 8 2 2 2 2 2 2 2 2 11 2 2 2 2 2 2 2 13 2 2 2 2 2 2 2 2 9 2 2 12 2 15 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:
15
result:
ok single line: '15'
Test #85:
score: 26
Accepted
time: 26ms
memory: 77412kb
input:
500000 13 1 13 1 1 13 13 13 1 1 13 13 13 1 13 1 1 1 1 1 13 13 4 13 1 13 1 13 13 1 13 1 13 3 13 1 10 13 13 13 13 1 1 1 13 13 1 11 1 1 13 13 1 1 1 13 5 13 1 13 1 13 13 13 1 13 1 13 1 1 1 1 7 13 1 1 8 1 1 13 13 13 9 13 13 13 13 1 1 1 1 1 1 13 1 1 1 13 13 1 15 13 1 13 3 13 13 13 13 6 2 13 13 13 13 1 13 ...
output:
15
result:
ok single line: '15'
Test #86:
score: 26
Accepted
time: 16ms
memory: 81592kb
input:
499995 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 #87:
score: 26
Accepted
time: 15ms
memory: 81520kb
input:
499995 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
15
result:
ok single line: '15'
Test #88:
score: 26
Accepted
time: 18ms
memory: 77020kb
input:
500000 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
1
result:
ok single line: '1'
Test #89:
score: 26
Accepted
time: 23ms
memory: 77032kb
input:
500000 4 1 9 1 9 1 10 1 10 1 4 1 15 1 4 1 6 1 14 1 2 1 1 1 13 1 10 1 1 1 4 1 12 1 2 1 14 1 10 1 8 1 13 1 10 1 15 1 14 1 2 1 8 1 5 1 3 1 4 1 9 1 6 1 15 1 9 1 3 1 15 1 3 1 13 1 9 1 13 1 14 1 14 1 8 1 12 1 11 1 10 1 3 1 4 1 1 2 12 1 11 1 3 1 11 1 6 1 4 1 7 1 13 1 13 1 8 1 14 1 12 1 6 1 4 1 15 1 2 1 7 1...
output:
12
result:
ok single line: '12'
Test #90:
score: 26
Accepted
time: 24ms
memory: 77372kb
input:
500000 14 1 6 2 6 1 8 1 11 1 14 1 1 1 8 1 15 1 12 1 14 1 13 2 12 1 1 1 6 1 9 1 15 1 4 1 2 1 12 2 7 1 2 1 8 2 4 1 13 2 14 2 14 1 10 1 14 1 3 1 2 1 14 1 6 1 1 2 13 1 8 1 10 1 2 1 11 1 14 1 6 1 4 2 7 1 10 1 15 1 7 1 8 1 1 1 4 1 12 1 13 1 13 1 1 1 8 1 12 1 7 2 10 1 3 1 3 1 12 1 8 2 11 1 4 1 1 1 14 1 15 ...
output:
13
result:
ok single line: '13'
Test #91:
score: 26
Accepted
time: 17ms
memory: 77532kb
input:
500000 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
14
result:
ok single line: '14'
Test #92:
score: 26
Accepted
time: 16ms
memory: 76896kb
input:
500000 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
12
result:
ok single line: '12'
Subtask #6:
score: 10
Accepted
Test #93:
score: 10
Accepted
time: 94ms
memory: 77364kb
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: 137ms
memory: 77404kb
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: 105ms
memory: 79672kb
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: 125ms
memory: 76748kb
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: 10
Accepted
time: 197ms
memory: 79540kb
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:
2
result:
ok single line: '2'
Test #98:
score: 10
Accepted
time: 326ms
memory: 77336kb
input:
500000 1 1 1 1 1 1 1 8 2 2 1 1 2 1 1 1 1 1 1 1 1 2 1 14 1 1 1 1 1 1 1 1 1 1 1 20 1 1 1 1 1 1 1 1 1 1 1 2 1 9 1 1 1 1 10 1 1 15 1 1 1 1 15 1 1 14 1 21 1 1 3 1 15 1 1 11 1 2 1 1 1 1 1 1 1 1 1 1 1 2 1 15 1 1 2 21 1 1 1 1 1 1 5 1 1 6 1 1 1 1 1 4 1 2 3 1 2 1 1 1 1 1 3 1 15 1 1 1 2 1 1 3 1 1 1 1 1 1 1 1 1...
output:
15
result:
ok single line: '15'
Test #99:
score: 10
Accepted
time: 340ms
memory: 79672kb
input:
500000 13 2 6 1 6 1 4 1 10 1 2 1 20 1 13 3 7 1 5 1 4 1 7 1 2 1 19 1 8 1 17 1 15 1 2 2 3 1 18 1 2 1 12 4 10 2 21 1 10 1 2 1 20 1 17 1 3 1 19 1 9 1 11 1 13 1 12 2 15 2 7 1 10 1 21 1 15 1 16 2 13 1 1 2 15 1 1 1 21 2 5 1 19 1 17 2 15 1 18 1 21 5 1 1 8 3 10 1 18 1 15 1 4 1 8 1 11 2 21 1 19 3 4 1 19 1 15 ...
output:
19
result:
ok single line: '19'
Test #100:
score: 10
Accepted
time: 368ms
memory: 81588kb
input:
500000 15 1 14 1 12 1 18 1 2 1 21 1 10 1 2 1 12 1 19 1 21 1 19 1 16 1 16 1 3 1 4 1 20 1 4 1 8 1 7 2 10 1 5 1 11 1 21 1 9 1 17 1 16 1 11 1 9 1 21 1 1 1 15 1 19 2 11 1 9 1 2 2 3 1 12 1 4 1 1 1 2 1 9 1 15 1 17 2 19 1 21 1 12 1 5 1 19 1 15 1 5 1 1 1 14 1 12 1 12 1 12 1 4 1 1 1 14 1 20 2 6 1 15 1 17 1 2 ...
output:
16
result:
ok single line: '16'
Test #101:
score: 10
Accepted
time: 319ms
memory: 77008kb
input:
500000 21 3 19 1 17 1 10 2 17 1 14 2 12 4 2 2 11 1 11 2 16 1 17 2 19 1 15 2 3 1 21 5 12 1 3 2 16 3 12 1 11 8 13 1 16 1 20 2 12 1 19 1 14 1 7 1 2 2 21 1 4 4 17 2 2 2 12 1 9 2 12 2 19 1 9 1 7 4 20 1 13 2 17 2 7 1 4 2 14 2 10 1 20 3 18 1 15 1 15 3 17 1 3 2 17 1 6 1 13 2 17 10 21 3 9 3 13 2 7 4 19 1 4 1...
output:
21
result:
ok single line: '21'
Test #102:
score: 10
Accepted
time: 342ms
memory: 79540kb
input:
500000 19 1 1 1 7 1 19 1 9 1 10 1 15 1 20 1 16 5 6 2 8 1 9 1 17 1 16 2 7 1 15 1 4 4 10 1 6 1 9 1 3 1 4 1 17 1 7 1 21 1 1 1 4 1 5 2 21 3 17 1 1 1 3 1 6 1 18 1 11 1 17 3 17 2 19 1 3 1 7 3 12 1 17 2 10 1 8 1 11 1 17 1 18 1 3 1 17 2 11 1 13 2 8 2 14 2 12 4 16 1 7 3 9 1 4 1 4 1 15 1 18 1 10 1 6 1 14 3 13...
output:
18
result:
ok single line: '18'
Test #103:
score: 10
Accepted
time: 340ms
memory: 81720kb
input:
500000 10 1 20 2 11 1 19 1 3 1 21 2 6 1 10 1 2 1 12 1 9 1 21 1 7 3 16 1 3 1 20 1 10 2 14 2 20 2 3 2 6 2 5 1 6 1 17 1 3 3 3 2 19 2 6 1 4 1 8 1 3 1 12 3 6 1 11 1 14 1 2 1 14 1 8 2 11 1 11 2 13 1 10 1 9 1 16 1 15 2 19 2 1 2 8 2 17 1 19 2 13 2 7 1 6 1 18 2 16 1 9 2 17 1 11 2 14 2 13 4 21 2 4 1 12 4 3 1 ...
output:
19
result:
ok single line: '19'
Test #104:
score: 10
Accepted
time: 339ms
memory: 81720kb
input:
500000 2 2 19 1 6 1 16 1 17 1 1 1 8 3 11 1 6 1 8 1 19 1 1 1 7 1 2 1 18 2 14 1 11 1 9 1 1 3 7 1 16 1 2 1 14 1 18 1 15 1 6 1 16 1 13 2 12 1 16 2 2 1 1 2 7 1 21 1 16 1 5 1 8 1 7 2 1 2 8 1 12 3 4 1 7 1 8 1 20 1 18 1 12 1 11 1 18 1 2 1 7 2 17 1 13 1 5 1 2 3 12 1 3 1 3 1 6 1 9 1 7 1 2 1 19 1 18 1 10 1 17 ...
output:
18
result:
ok single line: '18'
Test #105:
score: 10
Accepted
time: 15ms
memory: 77376kb
input:
500000 21 21 20 21 20 21 21 18 21 19 20 21 21 19 21 21 20 21 21 21 21 19 19 21 21 21 21 21 20 20 20 21 21 20 21 18 21 20 18 19 19 21 21 20 21 19 21 21 21 21 20 21 19 21 21 18 18 18 21 18 19 21 21 21 21 18 21 21 19 21 18 19 21 19 19 19 21 20 21 19 18 20 21 19 21 21 18 21 21 18 18 21 21 21 21 21 21 21...
output:
21
result:
ok single line: '21'
Test #106:
score: 10
Accepted
time: 108ms
memory: 76816kb
input:
500000 6 14 14 14 17 2 14 14 14 14 12 11 20 17 14 14 14 2 14 8 7 6 2 14 13 14 14 14 14 14 14 14 1 14 14 14 1 14 14 14 14 1 14 4 14 15 14 14 13 12 2 4 3 1 14 14 17 13 1 14 8 14 14 14 16 14 14 21 14 16 1 14 17 16 19 14 14 19 14 14 14 14 11 20 14 14 18 17 14 14 14 13 12 14 14 5 14 21 4 14 14 2 14 17 14...
output:
21
result:
ok single line: '21'
Test #107:
score: 10
Accepted
time: 192ms
memory: 81588kb
input:
500000 9 9 9 9 9 10 9 9 21 9 9 6 9 9 9 9 9 6 9 9 9 9 9 9 9 9 9 9 12 9 9 9 9 6 9 9 8 20 6 9 9 21 9 9 9 9 20 9 9 9 9 9 9 9 3 9 9 9 9 9 9 9 9 19 9 9 9 9 11 9 9 9 9 5 15 11 9 9 9 9 9 9 9 9 9 20 9 20 9 9 9 5 9 9 9 9 9 9 9 4 9 9 9 9 9 9 9 9 9 9 9 9 9 9 14 2 9 16 10 9 11 16 9 9 9 9 16 9 9 19 9 4 9 2 9 9 9 ...
output:
21
result:
ok single line: '21'
Test #108:
score: 10
Accepted
time: 168ms
memory: 81588kb
input:
500000 20 16 16 16 16 16 16 19 5 16 5 16 16 5 5 5 16 16 16 5 16 16 5 6 5 5 16 16 18 16 5 16 16 16 16 16 5 5 16 5 5 16 5 5 16 5 5 16 16 5 16 7 16 5 16 5 16 5 5 20 12 9 16 16 5 16 17 16 7 16 5 5 16 5 16 5 16 5 16 16 5 16 16 5 5 5 16 5 16 16 16 5 5 16 5 5 16 5 16 16 16 5 5 16 5 5 5 16 16 5 16 5 5 5 6 1...
output:
19
result:
ok single line: '19'
Test #109:
score: 10
Accepted
time: 5ms
memory: 16212kb
input:
21 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
output:
1
result:
ok single line: '1'
Test #110:
score: 10
Accepted
time: 9ms
memory: 18252kb
input:
21 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1
output:
10
result:
ok single line: '10'
Test #111:
score: 10
Accepted
time: 4ms
memory: 18124kb
input:
42 1 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
output:
1
result:
ok single line: '1'
Test #112:
score: 10
Accepted
time: 7ms
memory: 18124kb
input:
42 21 21 20 20 19 19 18 18 17 17 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1 1
output:
21
result:
ok single line: '21'
Test #113:
score: 10
Accepted
time: 13ms
memory: 77352kb
input:
499989 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 #114:
score: 10
Accepted
time: 13ms
memory: 79540kb
input:
499989 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21...
output:
21
result:
ok single line: '21'
Test #115:
score: 10
Accepted
time: 10ms
memory: 80660kb
input:
500000 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21...
output:
1
result:
ok single line: '1'
Test #116:
score: 10
Accepted
time: 21ms
memory: 79532kb
input:
500000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15...
output:
21
result:
ok single line: '21'
Test #117:
score: 10
Accepted
time: 19ms
memory: 79668kb
input:
500000 21 20 19 18 17 16 15 14 12 11 10 9 8 7 6 5 4 3 2 1 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...
output:
19
result:
ok single line: '19'
Test #118:
score: 10
Accepted
time: 16ms
memory: 79448kb
input:
500000 21 20 19 18 17 16 15 14 13 11 10 9 8 7 6 5 4 3 1 18 15 18 15 15 18 18 18 15 18 15 15 18 15 18 15 15 15 18 18 15 18 18 18 18 15 15 15 18 18 15 15 15 18 18 15 15 15 15 18 15 18 15 18 15 18 15 18 15 15 18 18 18 15 18 15 18 18 15 15 18 18 15 18 15 15 15 15 18 18 18 18 18 15 18 15 18 18 15 15 15 1...
output:
17
result:
ok single line: '17'
Test #119:
score: 10
Accepted
time: 21ms
memory: 76988kb
input:
500000 21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...
output:
20
result:
ok single line: '20'
Test #120:
score: 10
Accepted
time: 23ms
memory: 79540kb
input:
500000 21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...
output:
19
result:
ok single line: '19'
Test #121:
score: 10
Accepted
time: 19ms
memory: 81592kb
input:
500000 21 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...
output:
17
result:
ok single line: '17'
Subtask #7:
score: 18
Accepted
Test #122:
score: 18
Accepted
time: 226ms
memory: 616244kb
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: 201ms
memory: 616080kb
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: 222ms
memory: 616208kb
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: 210ms
memory: 616076kb
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: 18
Accepted
time: 291ms
memory: 616224kb
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...
output:
2
result:
ok single line: '2'
Test #127:
score: 18
Accepted
time: 439ms
memory: 616080kb
input:
5000000 1 1 1 1 1 1 11 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 2 1 1 1 1 1 1 3 1 1 1 1 13 2 1 1 1 1 1 1 14 1 1 1 7 1 3 2 1 1 2 1 1 7 1 1 2 1 1 1 1 1 2 1 2 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 16 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 ...
output:
17
result:
ok single line: '17'
Test #128:
score: 18
Accepted
time: 441ms
memory: 616116kb
input:
5000000 6 1 18 1 1 1 19 1 14 2 3 1 13 2 21 2 2 1 21 1 17 1 5 2 12 1 8 2 3 2 7 1 11 1 21 1 10 1 4 2 2 2 7 2 16 1 11 1 3 1 5 1 20 1 6 1 20 1 8 1 21 1 15 1 19 1 19 1 14 1 10 1 5 1 8 1 14 1 1 4 14 1 13 1 17 1 3 1 7 1 9 2 7 1 8 2 20 1 6 2 18 1 3 2 12 1 3 2 1 1 21 2 21 1 9 1 16 1 12 1 4 2 5 2 20 1 12 1 14...
output:
20
result:
ok single line: '20'
Test #129:
score: 18
Accepted
time: 454ms
memory: 616080kb
input:
5000000 2 1 1 1 13 2 11 1 13 1 2 1 14 1 9 1 17 1 13 1 18 1 10 1 12 1 15 1 16 1 1 1 4 1 19 2 17 1 6 1 21 1 7 2 20 1 17 1 5 1 8 1 11 2 6 1 20 1 19 1 3 1 1 1 2 1 3 1 2 1 5 1 15 1 19 1 11 1 20 1 9 1 8 1 6 1 6 1 3 1 4 1 1 2 8 2 2 1 11 1 4 1 9 1 13 1 1 1 18 1 20 1 20 1 21 1 9 1 4 1 5 1 8 1 6 1 12 1 17 2 3...
output:
17
result:
ok single line: '17'
Test #130:
score: 18
Accepted
time: 426ms
memory: 616080kb
input:
5000000 19 1 10 1 12 1 6 2 18 1 19 2 4 1 21 1 8 2 9 2 8 1 12 4 18 2 21 4 21 2 2 2 14 3 18 1 17 1 9 3 15 1 19 1 8 3 16 2 15 3 19 3 6 3 16 1 4 2 15 1 13 1 10 1 10 1 6 3 3 1 15 2 9 2 13 1 18 3 12 2 7 4 3 2 12 1 16 1 5 1 12 7 16 3 14 2 21 1 2 1 21 1 5 2 19 2 20 1 18 2 5 1 16 2 19 1 5 1 15 1 16 6 1 1 2 1...
output:
21
result:
ok single line: '21'
Test #131:
score: 18
Accepted
time: 113ms
memory: 616036kb
input:
5000000 19 21 21 18 20 21 19 21 18 21 20 21 21 21 21 20 21 21 18 19 18 18 21 20 21 21 21 20 21 21 20 19 21 21 18 18 18 21 18 20 18 21 21 20 21 20 21 20 19 19 21 21 21 18 20 21 21 18 21 21 21 21 18 21 19 19 21 18 21 19 21 20 21 21 19 20 20 20 21 21 21 21 21 21 18 21 21 18 18 21 21 19 20 20 19 20 20 2...
output:
21
result:
ok single line: '21'
Test #132:
score: 18
Accepted
time: 228ms
memory: 616208kb
input:
5000000 4 4 4 4 4 17 12 17 4 4 6 4 10 4 7 4 4 4 4 6 17 19 12 4 4 4 4 4 4 18 11 20 20 12 4 12 16 1 4 19 15 13 3 4 7 4 4 4 6 1 14 19 4 12 13 11 12 4 4 4 4 4 18 1 4 4 4 19 15 12 15 13 4 4 6 4 18 4 20 4 4 4 21 1 4 4 4 4 17 9 4 4 16 4 4 4 9 14 11 4 4 20 17 11 4 4 4 10 7 4 10 10 4 4 12 15 6 4 10 14 4 4 17...
output:
21
result:
ok single line: '21'
Test #133:
score: 18
Accepted
time: 265ms
memory: 616080kb
input:
5000000 14 14 5 17 14 14 14 10 14 14 14 14 14 14 14 14 14 14 14 14 12 14 14 14 14 14 14 14 14 14 13 14 14 12 19 4 14 14 14 14 14 14 14 5 14 14 14 14 19 14 14 4 14 14 14 9 14 20 14 14 14 14 14 16 14 14 14 14 14 14 14 14 14 20 8 14 20 14 14 2 16 14 16 21 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14 14...
output:
21
result:
ok single line: '21'
Test #134:
score: 18
Accepted
time: 156ms
memory: 616116kb
input:
5000000 14 3 9 3 3 3 9 9 9 3 9 3 3 3 9 3 3 9 3 7 3 3 3 9 3 12 15 3 9 8 19 9 9 3 3 9 3 3 3 3 9 9 9 21 3 9 3 3 3 9 3 3 3 3 9 9 9 9 9 9 3 9 3 3 10 9 9 9 3 3 1 3 9 9 9 3 9 9 5 14 3 3 3 9 3 3 3 17 3 9 9 9 3 3 9 3 9 9 3 3 3 15 3 9 3 9 9 3 9 9 9 9 3 9 3 9 9 9 9 3 9 3 18 9 3 3 9 3 3 3 9 17 9 9 3 9 9 3 9 3 9...
output:
21
result:
ok single line: '21'
Test #135:
score: 18
Accepted
time: 96ms
memory: 616244kb
input:
4999995 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 #136:
score: 18
Accepted
time: 105ms
memory: 616240kb
input:
4999995 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...
output:
21
result:
ok single line: '21'
Test #137:
score: 18
Accepted
time: 96ms
memory: 616052kb
input:
5000000 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 21 2...
output:
1
result:
ok single line: '1'
Test #138:
score: 18
Accepted
time: 458ms
memory: 616116kb
input:
5000000 9 1 19 1 10 1 20 1 13 1 12 1 16 1 21 1 6 1 5 1 7 1 15 1 18 2 7 1 10 1 2 1 18 1 9 1 13 1 11 2 18 1 17 3 12 1 2 2 3 1 14 1 12 1 19 1 19 2 17 1 1 3 1 1 19 1 7 1 8 1 21 1 15 1 5 1 6 1 1 1 21 1 10 1 19 1 1 2 10 1 16 1 4 1 16 1 15 1 7 1 17 1 21 1 7 1 3 1 13 2 2 1 19 1 20 1 17 1 13 1 10 1 5 2 3 1 2...
output:
19
result:
ok single line: '19'
Test #139:
score: 18
Accepted
time: 438ms
memory: 616244kb
input:
5000000 20 1 21 1 18 1 1 2 7 2 11 1 12 1 9 1 16 1 9 1 17 1 7 1 7 1 15 2 2 1 12 1 21 1 13 1 11 1 18 1 7 3 8 1 3 1 19 1 14 2 6 1 5 1 4 3 11 1 13 1 4 1 4 1 10 1 12 2 19 1 14 1 8 3 20 1 14 1 21 1 7 1 15 1 7 1 14 1 3 1 9 1 14 1 19 1 3 1 3 1 14 2 16 1 4 1 13 2 21 1 9 2 9 1 13 5 7 1 17 1 19 1 6 1 5 1 19 1 ...
output:
20
result:
ok single line: '20'
Test #140:
score: 18
Accepted
time: 113ms
memory: 616248kb
input:
5000000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 1...
output:
21
result:
ok single line: '21'
Test #141:
score: 18
Accepted
time: 91ms
memory: 616244kb
input:
5000000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 1 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 ...
output:
19
result:
ok single line: '19'
Test #142:
score: 18
Accepted
time: 132ms
memory: 616076kb
input:
5000000 21 19 18 17 16 14 13 12 11 10 9 8 7 6 5 4 3 2 1 5 20 20 5 20 5 5 5 5 20 5 5 5 20 20 20 20 20 5 5 20 20 20 20 5 20 5 20 20 5 5 20 5 5 5 20 20 5 5 5 20 5 5 5 5 5 5 5 20 5 5 20 20 20 5 20 20 20 20 20 20 20 20 20 20 20 20 5 5 20 5 20 20 5 5 5 20 5 5 5 5 5 5 20 20 20 5 5 5 20 5 5 20 5 5 20 5 5 20...
output:
17
result:
ok single line: '17'
Test #143:
score: 18
Accepted
time: 101ms
memory: 616240kb
input:
5000000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...
output:
18
result:
ok single line: '18'
Test #144:
score: 18
Accepted
time: 111ms
memory: 616076kb
input:
5000000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...
output:
16
result:
ok single line: '16'
Test #145:
score: 18
Accepted
time: 128ms
memory: 616244kb
input:
5000000 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 21 6 6 6 6 6 21 21 6 21 21 21 21 6 21 6 21 6 6 6 6 21 6 6 21 21 6 21 6 21 6 21 6 21 6 6 6 21 21 6 21 21 21 6 21 6 6 21 21 6 21 6 21 21 6 21 21 6 6 6 21 6 6 6 21 21 21 6 21 6 6 21 6 6 21 6 21 6 6 6 6 21 21 6 6 6 21 21 21 6 21 6 21 21 6 21 ...
output:
16
result:
ok single line: '16'
Extra Test:
score: 0
Extra Test Passed