QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#109166#6528. Sequence_yjh70 1854ms79988kbC++144.9kb2023-05-27 17:54:442023-05-27 17:54:47

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-27 17:54:47]
  • 评测
  • 测评结果:70
  • 用时:1854ms
  • 内存:79988kb
  • [2023-05-27 17:54:44]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
inline ll read() {
	ll x=0,f=1;char ch=getchar();
	while(!isdigit(ch)) {if(ch=='-')f=-1;ch=getchar();}
	while(isdigit(ch)) {x=x*10+ch-48;ch=getchar();}
	return x*f;
}
inline int maxx(int a,int b) {
    if(a>b) return a;
    return b;
}
inline int minn(int a,int b) {
	if(a>b) return b;
	return a;
}
const ll MAXN=555555;
int n,cnt,a[MAXN],b[MAXN],nw[MAXN];
map <int,int> mp;
vector <int> p[MAXN];
struct range {
	int l,r;
	void add(int a) {
		l=minn(l,a),r=maxx(r,a);
	}
};
inline range merge(range a,range b) {
	return (range){a.l+b.l,a.r+b.r};
}
struct SGTree {
	#define lc t<<1
	#define rc t<<1|1
	struct Node {
		int mx,mn,lz;
	}nd[4*MAXN];
	void pushup(int t) {
		nd[t].mx=maxx(nd[lc].mx,nd[rc].mx);
		nd[t].mn=minn(nd[lc].mn,nd[rc].mn);
	}
	void pushdown(int t) {
		if(nd[t].lz) {
			nd[lc].mn+=nd[t].lz;
			nd[rc].mn+=nd[t].lz;
			nd[lc].mx+=nd[t].lz;
			nd[rc].mx+=nd[t].lz;
			nd[lc].lz+=nd[t].lz;
			nd[rc].lz+=nd[t].lz;
			nd[t].lz=0;
		}
	}
	void Build(int t,int l,int r) {
		nd[t].lz=0;
		if(l==r) {
			nd[t].mx=nd[t].mn=l;
			return ;
		}
		int mid=(l+r)>>1;
		Build(lc,l,mid);
		Build(rc,mid+1,r);
		pushup(t);
	}
	void build() {
		Build(1,1,n);
	}
	void Update(int t,int l,int r,int ll,int rr,int k) {
		if(ll<=l&&r<=rr) {
			nd[t].mx+=k;
			nd[t].mn+=k;
			nd[t].lz+=k;
			return ;
		}
		pushdown(t);
		int mid=(l+r)>>1;
		if(ll<=mid) Update(lc,l,mid,ll,rr,k);
		if(rr>=mid+1) Update(rc,mid+1,r,ll,rr,k);
		pushup(t);
	}
	void upd(int p,int k) {
		if(nw[p]==k) return ;
		Update(1,1,n,p,n,(k-nw[p]));
		nw[p]=k;
	}
	int mx,mn;
	void QPOS(int t,int l,int r,int p) {
		if(l==r) {
			mx=nd[t].mx,mn=nd[t].mn;
			return ;
		}
		pushdown(t);
		int mid=(l+r)>>1;
		if(p<=mid) QPOS(lc,l,mid,p);
		else QPOS(rc,mid+1,r,p);
	}
	void Query(int t,int l,int r,int ll,int rr) {
		if(ll<=l&&r<=rr) {
			mx=maxx(mx,nd[t].mx);
			mn=minn(mn,nd[t].mn);
			return ;
		}
		pushdown(t);
		int mid=(l+r)>>1;
		if(ll<=mid) {
			if(nd[lc].mn>=mn&&nd[lc].mx<=mx);
			else Query(lc,l,mid,ll,rr);
		}
		if(rr>=mid+1) {
			if(nd[rc].mn>=mn&&nd[rc].mx<=mx);
			else Query(rc,mid+1,r,ll,rr);
		}
	}
	void init() {
		mx=-(n+1),mn=(n+1);
	}
	inline int qsum(int l,int r) {
		if(l>r) return 0;
		int sum=0;
		init();
		QPOS(1,1,n,r);
		sum+=mx;
		if(l!=1) {
			init();
			QPOS(1,1,n,l-1);
			sum-=mx;
		}
		return sum;
	}
	inline range qsuf(int x) {
		range ans=(range){0,0};
		if(!x) return ans;
		int sum=qsum(1,x);
		init();
		Query(1,1,n,1,x);
		ans.l=mn,ans.r=mx;
		ans.add(0);
		int tl=sum-ans.r,tr=sum-ans.l;
		ans.l=tl,ans.r=tr;
		return ans;
	}
	inline range qpre(int x) {
		range ans=(range){0,0};
		if(x==n+1) return ans;
		int sum=qsum(1,x-1);
		init();
		Query(1,1,n,x,n);
		ans.l=mn-sum,ans.r=mx-sum;
		ans.add(0);
		return ans;
	}
	inline bool judge(int x,int l,int r) {
		range nw=merge(qsuf(l-1),qpre(r+1));
		int sum=qsum(l,r);
		nw.l+=sum,nw.r+=sum;
		if(nw.r<=0) return x>=(-nw.r);
		if(nw.l>=0) return x>=nw.l;
		return 1;
	}
}sgt;
inline bool check(int num,int x) {
	int sz=p[num].size();
	for(register int i=0;i<sz;i++) {
		if(i<x) sgt.upd(p[num][i],0);
		else sgt.upd(p[num][i],1);
	}
	for(register int l=0;l+x-1<sz;l++) {
		int r=l+x-1;
		sgt.upd(p[num][r],0);
		if(sgt.judge(x,p[num][l],p[num][r])) return true;
		sgt.upd(p[num][l],-1);
	}
	return false;
}
void clear(int x) {
	int sz=p[x].size();
	for(register int i=0;i<sz;i++) sgt.upd(p[x][i],-1);
}
inline int solve() {
	sgt.build();
	int fans=1;
	for(register int i=1;i<=n;i++) nw[i]=1;
	for(register int i=1;i<=cnt;i++) {
		int sz=p[i].size();
		int l=fans+1,r=sz,ans=-1;
		while(l<=r) {
			int mid=(l+r)>>1;
			if(check(i,mid)) l=mid+1,ans=mid;
			else r=mid-1;
		}
		fans=max(fans,ans);
		clear(i);
//		if(clock()/CLOCKS_PER_SEC>1.97) return fans;
	}
	return fans;
}
inline bool check1(int x) {
	sgt.build();
	for(register int i=1;i<=n;i++) nw[i]=1;
	for(register int i=1;i<=cnt;i++) {
		int sz=p[i].size();
		if(sz>=x) {
			for(register int j=0;j<x;j++) sgt.upd(p[i][j],0);
			for(register int l=0;l+x-1<sz;l++) {
				int r=l+x-1;
				sgt.upd(p[i][r],0);
				if(sgt.judge(x,p[i][l],p[i][r])) return true;
				sgt.upd(p[i][l],-1);
			} 
		}
		for(register int j=0;j<sz;j++) sgt.upd(p[i][j],-1);
	}
	return false;
}
int sequence(int N, std::vector<int> A) {
	n=N;
	for(register int i=1;i<=n;i++) a[i]=b[i]=A[i-1];
	sort(b+1,b+n+1);
    for(register int i=1;i<=n;i++) if(b[i]!=b[i-1]) mp[b[i]]=++cnt;
    for(register int i=1;i<=n;i++) {
    	a[i]=mp[a[i]];
    	p[a[i]].push_back(i);
    }
    if(cnt<=sqrt(N)) {
    	int l=1,r=n,ans=-1;
        while(l<=r) {
        	int mid=(l+r)>>1;
        	if(check1(mid)) l=mid+1,ans=mid;
        	else r=mid-1;
    	}
    	return ans;
	}
    return solve();
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 3ms
memory: 24072kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
98
92 89 9 86 80 6 42 20 84 82 46 56 52 30 44 39 35 82 57 33 18 38 32 63 27 55 33 44 41 39 62 26 46 59 21 85 36 60 7 36 50 22 87 83 71 27 4 3 87 47 17 62 70 24 9 20 81 21 57 50 13 32 68 70 11 95 5 56 64 90 47 42 44 72 71 46 84 72 56 63 37 35 80 78 4 54 74 79 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
3

result:

ok 

Test #2:

score: 0
Accepted
time: 1ms
memory: 22032kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
96
1 6 1 4 6 2 5 1 1 2 8 2 4 4 1 9 8 9 8 5 3 6 6 4 9 4 2 8 8 8 2 9 1 3 6 6 1 6 5 5 3 7 9 7 1 8 5 6 8 5 1 1 4 9 6 7 2 6 6 7 4 2 2 8 5 6 4 8 2 6 5 8 6 1 6 2 1 3 4 6 3 6 8 2 5 7 8 2 4 1 5 6 2 3 6 6

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
18

result:

ok 

Test #3:

score: 0
Accepted
time: 2ms
memory: 22024kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
99
1 3 5 1 2 4 1 3 4 1 5 5 3 1 1 4 2 1 4 5 5 4 1 4 4 2 1 2 2 1 5 2 4 2 1 5 1 3 3 4 3 2 3 1 3 2 2 4 1 5 4 2 2 2 4 5 3 4 3 2 3 4 5 4 5 1 2 2 2 5 3 1 3 5 1 2 1 2 1 2 3 1 4 4 4 5 3 3 3 5 1 3 4 2 4 4 2 1 2

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
19

result:

ok 

Test #4:

score: 0
Accepted
time: 1ms
memory: 24056kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
100
29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
100

result:

ok 

Test #5:

score: 0
Accepted
time: 5ms
memory: 24116kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
97
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 8...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #6:

score: 0
Accepted
time: 1ms
memory: 22132kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
100
48 40 13 1 8 31 46 19 42 9 13 8 33 43 85 9 36 21 83 49 4 49 49 24 49 82 9 88 24 33 23 99 79 46 83 49 2 4 40 92 49 44 92 99 49 49 38 49 12 29 49 89 100 81 79 85 22 38 49 8 27 29 3 100 100 42 82 49 31 26 40 49 46 10 49 49 84 77 93 20 33 90 49 18 49 49 18 84...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
18

result:

ok 

Test #7:

score: 0
Accepted
time: 1ms
memory: 22040kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
97
42 47 7 23 9 10 53 75 53 53 2 1 75 14 4 16 53 35 32 37 97 31 47 91 77 84 53 87 93 85 70 80 2 19 53 53 67 85 25 3 37 41 52 21 30 84 25 15 37 30 97 53 22 97 33 97 53 9 69 38 71 6 74 4 13 26 27 90 91 47 11 90 7 76 97 17 80 53 23 95 73 53 1 21 43 42 2 33 29 32...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
11

result:

ok 

Test #8:

score: 0
Accepted
time: 2ms
memory: 22136kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
98
72 73 8 81 47 26 17 61 93 69 95 7 25 42 15 45 17 88 42 94 68 49 23 50 93 42 97 43 11 7 83 42 43 42 57 12 76 54 61 76 71 42 62 87 87 7 42 83 92 47 72 66 88 1 23 51 42 26 74 42 84 70 59 42 83 14 60 81 53 56 42 20 56 8 92 69 42 76 42 24 87 70 4 80 79 61 66 93...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
5

result:

ok 

Test #9:

score: 0
Accepted
time: 2ms
memory: 22196kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
99
85 88 94 94 59 47 63 75 75 40 38 35 59 56 81 48 96 47 46 34 96 62 35 46 83 34 95 34 69 48 15 10 3 92 67 34 38 92 84 84 42 49 86 63 82 65 39 89 80 14 34 69 55 42 67 34 68 86 15 72 18 96 2 7 1 89 16 68 65 97 52 38 92 34 87 16 2 62 34 18 34 74 34 8 21 77 45 8...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
7

result:

ok 

Subtask #2:

score: 17
Accepted

Dependency #1:

100%
Accepted

Test #10:

score: 17
Accepted
time: 5ms
memory: 24380kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1999
486 1494 1286 1247 138 393 816 1646 971 1657 1284 1320 702 194 602 1775 13 1856 61 1264 1005 681 1679 1174 718 1781 1407 97 365 1949 1805 1609 1066 637 98 1686 1361 584 146 1879 941 62 1433 1850 729 1754 71 1292 1945 1328 1705 362 591 407 998 1909 1690 2...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
4

result:

ok 

Test #11:

score: 0
Accepted
time: 1ms
memory: 24236kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1996
1475 182 1399 123 1593 884 1167 1543 663 302 16 217 1284 1777 1875 1996 1238 1368 52 1935 881 235 1437 1002 1000 1473 1248 540 139 282 850 451 797 1595 803 1050 293 1827 1677 1323 1617 1760 13 151 1329 74 1828 1609 532 1224 103 685 1040 48 88 238 501 873...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
3

result:

ok 

Test #12:

score: 0
Accepted
time: 1ms
memory: 22088kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1996
12 36 13 34 17 23 24 32 24 36 28 31 27 19 26 31 24 6 42 32 19 43 25 32 13 39 34 39 24 29 15 32 16 28 36 2 3 37 7 42 34 11 43 25 31 17 43 24 27 43 6 28 17 25 33 44 41 14 27 11 2 5 20 20 7 17 11 19 8 16 2 26 20 43 4 7 43 42 15 19 40 14 31 24 39 16 13 23 19...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
52

result:

ok 

Test #13:

score: 0
Accepted
time: 5ms
memory: 22140kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1998
25 16 15 17 25 1 7 36 24 40 30 2 34 13 38 39 33 1 5 4 3 37 36 17 41 29 21 29 19 12 2 38 18 2 42 11 40 39 21 18 43 26 9 10 11 36 36 38 12 13 8 28 23 26 3 44 32 33 18 15 15 27 18 9 25 36 16 27 4 30 10 26 35 27 43 5 29 33 8 14 43 42 6 12 34 6 28 22 30 3 24 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
49

result:

ok 

Test #14:

score: 0
Accepted
time: 5ms
memory: 24140kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1999
4 5 1 2 5 4 4 4 2 5 3 5 3 3 1 2 5 5 2 3 3 2 2 4 5 3 4 3 2 1 4 2 3 5 2 2 2 5 4 3 5 1 4 2 5 4 3 2 5 3 4 3 5 2 1 1 4 3 2 5 2 1 5 3 5 3 2 4 5 4 1 2 1 2 1 4 3 5 5 2 1 3 3 4 4 4 2 5 4 2 1 2 4 2 5 3 1 1 4 2 3 4 5 2 5 1 3 3 1 2 2 5 1 5 5 4 4 3 2 2 5 4 1 2 3 1 5 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
378

result:

ok 

Test #15:

score: 0
Accepted
time: 8ms
memory: 22336kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #16:

score: 0
Accepted
time: 0ms
memory: 22336kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1997
831 845 694 533 66 466 615 401 522 181 171 87 245 250 581 66 257 441 723 212 992 910 126 106 798 939 845 214 654 754 761 109 684 708 167 693 44 255 492 586 122 295 637 565 827 487 436 630 97 454 117 814 403 306 637 822 223 327 105 95 996 416 650 181 917 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
261

result:

ok 

Test #17:

score: 0
Accepted
time: 2ms
memory: 22312kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1998
696 737 209 283 554 1052 842 822 892 502 136 1036 301 8 855 900 228 338 233 954 326 410 770 850 455 582 579 993 213 319 562 894 541 947 1010 14 743 908 277 859 458 763 463 816 923 585 880 618 352 622 780 619 11 429 133 180 258 139 807 753 350 197 616 471...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
398

result:

ok 

Test #18:

score: 0
Accepted
time: 0ms
memory: 22260kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1997
657 1176 941 515 903 1021 551 1103 491 661 1188 961 1073 923 78 355 1094 1112 1092 1006 1243 297 92 1052 223 1005 61 123 116 771 250 1080 874 1238 1046 128 360 1119 212 451 1173 13 303 443 303 1198 119 467 361 1168 784 1062 369 685 366 126 436 272 1141 8...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
29

result:

ok 

Test #19:

score: 0
Accepted
time: 4ms
memory: 22288kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
1997
1079 227 1250 808 655 731 548 961 966 324 922 1264 376 203 925 805 692 1086 186 832 399 817 899 917 317 1056 737 246 936 180 90 1277 375 790 1006 934 1055 24 1138 1017 265 601 970 1160 600 994 262 340 20 1197 889 1251 885 522 106 972 602 616 990 332 1159...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
30

result:

ok 

Subtask #3:

score: 7
Accepted

Test #20:

score: 7
Accepted
time: 289ms
memory: 64932kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499996
53 78 81 111 119 124 126 130 164 175 219 227 233 249 282 298 332 341 348 436 437 448 452 455 462 465 495 535 557 558 576 600 620 627 632 642 643 659 695 696 713 730 743 805 816 865 869 872 875 882 883 902 924 937 990 998 1025 1092 1137 1145 1166 1176 1...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
8

result:

ok 

Test #21:

score: 0
Accepted
time: 304ms
memory: 66832kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499996
5 7 11 19 19 19 19 23 23 27 29 31 32 33 34 37 37 40 45 49 53 57 67 69 70 76 79 80 82 82 84 89 91 96 105 109 109 109 110 111 112 113 116 119 120 121 122 129 133 135 136 142 145 147 148 151 155 160 161 162 162 171 174 177 178 179 180 181 185 189 191 192 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
9

result:

ok 

Test #22:

score: 0
Accepted
time: 1428ms
memory: 42316kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
100281

result:

ok 

Test #23:

score: 0
Accepted
time: 294ms
memory: 62520kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 7 8 11 15 17 18 19 19 20 22 24 29 33 33 35 37 39 46 47 48 49 49 49 52 54 57 60 60 62 62 63 68 70 71 72 72 78 79 79 85 86 86 92 94 94 97 99 100 100 106 108 110 114 116 118 119 122 125 127 128 133 133 134 136 137 144 144 145 148 152 153 153 153 160 161...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
9

result:

ok 

Test #24:

score: 0
Accepted
time: 285ms
memory: 64420kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499996
18 24 36 39 56 61 85 128 159 164 225 240 252 254 258 263 313 365 387 387 396 439 443 476 481 489 509 526 547 582 583 584 631 635 645 673 679 699 709 724 728 731 741 757 768 785 785 817 827 828 834 836 846 851 858 864 892 900 908 920 920 922 929 962 989...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
11

result:

ok 

Test #25:

score: 0
Accepted
time: 1292ms
memory: 42464kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499996
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
8818

result:

ok 

Test #26:

score: 0
Accepted
time: 1854ms
memory: 42660kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
7068

result:

ok 

Test #27:

score: 0
Accepted
time: 1471ms
memory: 42152kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499998
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
176759

result:

ok 

Subtask #4:

score: 0
Time Limit Exceeded

Test #28:

score: 12
Accepted
time: 1252ms
memory: 44232kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
2 1 2 2 2 1 2 3 1 3 1 2 2 1 2 1 1 2 1 1 2 1 1 2 1 2 1 1 1 1 1 2 2 1 1 2 1 1 1 2 1 2 1 1 1 2 3 3 3 3 1 3 1 2 2 1 1 1 3 1 3 1 1 2 1 2 2 2 1 3 2 1 1 1 2 2 1 2 2 3 1 2 2 1 2 2 1 1 2 1 1 2 2 1 2 2 1 1 1 1 2 2 1 1 1 1 1 2 1 1 2 1 1 3 2 1 1 1 3 1 1 2 1 3 1 1 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
277713

result:

ok 

Test #29:

score: 0
Accepted
time: 1761ms
memory: 44036kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
2 3 1 3 3 3 1 2 3 3 3 2 2 1 1 3 1 2 1 3 3 3 2 2 2 2 3 3 2 2 2 1 1 2 3 3 1 3 1 1 2 3 3 1 1 1 2 1 1 1 2 3 2 2 1 2 1 1 3 1 1 1 3 1 1 2 1 3 2 3 1 3 1 3 3 2 1 3 1 2 1 3 2 1 1 2 3 1 2 1 3 3 1 2 1 3 3 3 2 3 2 1 1 2 1 2 3 1 1 2 2 1 3 2 3 2 3 2 2 1 3 2 3 1 3 3 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
166105

result:

ok 

Test #30:

score: 0
Accepted
time: 1424ms
memory: 42028kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499997
3 1 2 1 1 1 1 3 2 1 2 2 3 2 2 3 3 3 3 3 1 1 2 1 3 2 1 1 2 2 3 1 1 2 1 3 2 2 1 2 1 3 3 2 2 1 3 1 3 2 2 3 3 2 3 1 2 3 2 1 3 2 2 1 3 2 3 2 1 3 3 1 2 1 1 2 1 2 3 1 2 3 1 3 2 3 3 1 3 1 2 1 3 2 1 3 1 2 1 2 2 1 1 2 2 1 3 3 2 3 1 3 3 3 2 1 1 2 2 2 1 1 2 1 1 2 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
167067

result:

ok 

Test #31:

score: 0
Accepted
time: 1490ms
memory: 42416kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499996
3 2 3 3 3 1 2 3 2 2 2 2 2 2 2 3 2 2 3 1 3 1 3 2 1 2 2 3 3 3 3 1 2 1 2 2 3 2 2 2 3 3 2 2 2 1 2 2 2 3 3 2 3 3 3 3 3 2 1 3 3 2 3 3 3 3 2 2 3 3 2 1 2 2 3 3 2 3 1 1 3 2 3 2 1 3 3 2 3 3 3 1 3 2 2 3 3 2 2 3 2 3 3 2 3 3 3 2 1 1 3 3 1 2 3 3 1 3 2 3 3 3 3 3 3 2 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
277892

result:

ok 

Test #32:

score: -12
Time Limit Exceeded

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 1 3 ...

output:

Unauthorized output

result:


Subtask #5:

score: 13
Accepted

Test #33:

score: 13
Accepted
time: 552ms
memory: 79464kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
490225 471440 499001 369862 494577 479599 486292 476071 471988 486939 482356 482290 497141 488452 495446 494292 404798 493826 482595 481107 447196 477441 418064 495941 448927 483365 418585 489220 443224 482574 487957 467944 493253 472016 475543 442250 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #34:

score: 0
Accepted
time: 583ms
memory: 79268kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
490225 471440 499001 369862 494577 479599 486292 476071 471988 486939 482356 482290 497141 488452 495446 494292 404798 493826 482595 481107 447196 477441 418064 495941 448927 483365 418585 489220 443224 482574 487957 467944 493253 472016 475543 442250 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #35:

score: 0
Accepted
time: 608ms
memory: 79988kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
8693 471440 17469 369862 13045 479599 4760 476071 471988 5407 824 758 15609 6920 13914 12760 404798 12294 1063 481107 447196 477441 418064 14409 448927 1833 418585 7688 443224 1042 6425 467944 11721 472016 475543 442250 17475 477814 477933 468083 40726...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
2

result:

ok 

Test #36:

score: 0
Accepted
time: 587ms
memory: 79900kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
499999
8693 471440 17469 369862 13045 479599 4760 476071 471988 5407 824 758 15609 6920 13914 12760 404798 12294 1063 481107 447196 477441 418064 14409 448927 1833 418585 7688 443224 1042 6425 467944 11721 472016 475543 442250 17475 477814 477933 468083 40726...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
2

result:

ok 

Test #37:

score: 0
Accepted
time: 518ms
memory: 69388kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
2

result:

ok 

Test #38:

score: 0
Accepted
time: 509ms
memory: 69456kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #39:

score: 0
Accepted
time: 428ms
memory: 66476kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #40:

score: 0
Accepted
time: 381ms
memory: 65768kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
500000
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
2

result:

ok 

Subtask #6:

score: 22
Accepted

Dependency #2:

100%
Accepted

Test #41:

score: 22
Accepted
time: 75ms
memory: 31048kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79997
36415 18516 420 60790 49058 32960 27785 69895 74029 21962 53361 43308 54680 77334 61363 1780 62171 23208 1130 78835 79364 37259 45646 54570 72797 56842 34418 10553 28532 11521 52797 29973 58123 42899 62212 289 4565 10345 73305 14960 70036 68229 4746 966...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
4

result:

ok 

Test #42:

score: 0
Accepted
time: 73ms
memory: 30968kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79999
2369 72165 32418 54146 24301 41563 21615 7699 33072 35456 26173 19486 73698 33688 59226 47763 1541 58849 15638 51371 18405 57808 79167 49678 74972 71469 32184 65387 51189 50533 63690 31471 54573 14815 65689 75314 10202 4298 61619 53050 73668 1041 32184 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
5

result:

ok 

Test #43:

score: 0
Accepted
time: 58ms
memory: 30796kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79997
71636 54641 63515 75818 10828 13847 26543 26886 13803 30149 6575 6649 69980 23394 16782 11489 11513 66240 73286 53498 5285 66541 5949 18887 26181 14675 75092 42126 58501 60681 72961 60057 5928 24667 41569 50240 78722 65324 51958 49064 22821 41202 79834 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
4

result:

ok 

Test #44:

score: 0
Accepted
time: 231ms
memory: 29152kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79997
149 68 250 40 13 74 132 43 45 54 217 176 91 231 20 158 13 182 71 96 149 47 55 97 9 61 107 263 38 183 129 204 195 132 232 61 25 110 6 258 30 70 265 98 274 37 31 46 112 234 217 53 99 262 177 5 144 242 136 148 159 4 202 160 79 2 64 44 95 3 254 11 182 202 1...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
311

result:

ok 

Test #45:

score: 0
Accepted
time: 229ms
memory: 28856kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79998
55 115 154 115 29 27 198 38 207 97 206 95 270 111 9 101 164 216 200 207 177 37 227 84 74 92 41 44 129 148 94 109 117 108 150 33 149 171 263 191 176 76 163 172 255 141 73 70 235 16 21 109 63 240 13 170 213 20 264 61 68 54 264 93 186 148 157 134 101 130 1...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
313

result:

ok 

Test #46:

score: 0
Accepted
time: 289ms
memory: 28732kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
80000
35 275 60 121 246 211 20 272 146 146 192 226 253 176 252 112 28 190 104 111 136 121 25 217 30 109 49 96 247 183 46 118 97 105 202 203 150 185 83 95 86 29 119 98 221 274 260 73 247 21 269 142 126 132 71 32 89 82 250 242 143 70 275 41 147 146 260 22 155 2...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
275

result:

ok 

Test #47:

score: 0
Accepted
time: 235ms
memory: 28488kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79998
3 5 4 3 2 5 5 2 2 3 4 4 1 3 5 2 5 2 4 5 4 5 3 1 1 3 3 4 3 1 2 1 1 5 1 2 2 3 1 2 3 5 3 3 3 3 1 4 5 2 2 5 2 2 3 5 4 2 1 2 4 1 4 1 1 5 1 5 2 5 1 1 1 4 2 5 1 1 5 5 5 1 5 1 4 2 2 3 1 1 4 2 2 1 1 5 2 1 3 4 5 3 5 4 2 4 1 1 3 2 3 5 1 1 5 4 4 4 5 2 3 5 3 5 2 5 2...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
15817

result:

ok 

Test #48:

score: 0
Accepted
time: 201ms
memory: 28324kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79998
4 1 1 1 5 4 3 1 1 4 3 1 5 4 5 5 3 5 2 5 2 4 2 2 5 1 2 1 5 1 3 4 2 3 2 2 5 2 1 2 1 4 3 3 2 3 1 3 4 3 2 2 1 2 5 2 1 1 2 2 1 1 1 4 1 2 4 5 5 5 4 4 5 3 4 3 1 2 4 1 4 5 3 2 3 2 4 4 5 2 1 5 1 3 3 5 1 1 4 2 1 1 4 4 5 2 2 4 3 4 3 3 2 4 4 1 4 4 3 2 3 3 4 3 1 2 2...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
16034

result:

ok 

Test #49:

score: 0
Accepted
time: 186ms
memory: 28868kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79996
46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 46264 4...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
79996

result:

ok 

Test #50:

score: 0
Accepted
time: 48ms
memory: 31720kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 8...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
1

result:

ok 

Test #51:

score: 0
Accepted
time: 64ms
memory: 30760kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79999
62557 54115 63685 43356 64818 64586 79349 77356 41330 40364 58557 67912 75029 75261 41739 57089 48875 76675 50519 53949 44231 51337 60347 65214 73153 77774 59501 68638 46104 46374 79208 71027 42143 41676 43779 54113 49795 74574 54429 69536 75294 71917 6...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
9862

result:

ok 

Test #52:

score: 0
Accepted
time: 67ms
memory: 32220kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79997
27575 13483 28346 14285 14914 3379 5086 7591 2198 31337 7303 31403 12965 8490 35650 32504 17852 1280 17880 26640 26034 39333 29031 19342 18179 5938 21276 13311 13869 6363 34550 6598 5498 6170 937 15564 33382 24657 37644 25324 37511 13595 13242 9567 2430...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
8807

result:

ok 

Test #53:

score: 0
Accepted
time: 63ms
memory: 30380kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79997
52736 67305 65914 56940 63641 49250 46810 58347 52085 48628 42503 74158 65584 79847 65681 79484 68301 62194 62342 63293 69784 50461 57253 79110 42193 42876 49987 70330 78576 65097 76689 61117 65600 67661 46560 77202 42136 52391 69132 64515 63338 68002 5...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
12522

result:

ok 

Test #54:

score: 0
Accepted
time: 176ms
memory: 30276kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79998
61286 32983 44109 30329 68210 69740 51748 58074 75196 52516 40451 63345 45049 35584 77200 51800 79528 44901 73432 33935 48084 47419 67347 42425 63975 54935 47972 63731 65512 78008 41519 67309 42802 50180 42580 45471 33012 79801 61200 56087 66204 55638 6...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
76

result:

ok 

Test #55:

score: 0
Accepted
time: 162ms
memory: 28928kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79999
50334 51757 54816 63684 29666 68399 67533 36811 51420 67310 29594 37759 51160 70325 48955 76529 42418 44550 41632 30778 57812 73512 36854 44214 48434 38126 50668 56583 63796 34622 59409 44511 47249 38692 59127 34026 39565 58068 66302 40933 73447 39579 3...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
46

result:

ok 

Test #56:

score: 0
Accepted
time: 148ms
memory: 32216kb

input:

8wq90di9812978rqwiok0k0o21klklm21oiwi121
79996
22562 2963 19942 17563 39171 46717 13655 29802 24974 5889 46977 46106 11331 8899 38661 35807 11374 43020 16610 29814 4892 33348 7919 34404 36754 47615 9598 32448 45850 41725 15848 16914 7328 44954 37669 13068 8335 17211 41286 2366 34543 8010 8697 13232 ...

output:

nfp39szm23aa01pcmyosi03slwpeksnfjri3opqp
OK
55

result:

ok 

Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

0%