답안 #804317

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
804317 2023-08-03T08:00:24 Z kshitij_sodani 송신탑 (IOI22_towers) C++17
100 / 100
1981 ms 117524 KB
#include <bits/stdc++.h>
using namespace std;
#define a first
#define b second
#define pb push_back
typedef long long llo;
#include "towers.h"

#include <vector>
int st=0;
int n;
vector<int> it;
int tree[4*210001][2];

void build(int no,int l,int r){
	if(l==r){
		tree[no][0]=it[l];
		tree[no][1]=it[l];
	}
	else{
		int mid=(l+r)/2;
		build(no*2+1,l,mid);
		build(no*2+2,mid+1,r);
		tree[no][0]=min(tree[no*2+1][0],tree[no*2+2][0]);
		tree[no][1]=max(tree[no*2+1][1],tree[no*2+2][1]);
	}
}
int query(int no,int l,int r,int aa,int bb){
	if(r<aa or l>bb or aa>bb){
		return 1e9+1;
	}
	if(aa<=l and r<=bb){
		return tree[no][0];
	}
	int mid=(l+r)/2;
	return min(query(no*2+1,l,mid,aa,bb),query(no*2+2,mid+1,r,aa,bb));
}
int query2(int no,int l,int r,int aa,int bb){
	if(r<aa or l>bb or aa>bb){
		return -1;
	}
	if(aa<=l and r<=bb){
		return tree[no][1];
	}
	int mid=(l+r)/2;
	return max(query2(no*2+1,l,mid,aa,bb),query2(no*2+2,mid+1,r,aa,bb));
}
vector<int> mm;

void init(int nn, vector<int> ita) {
	n=nn;
	it=ita;
	st=0;
	build(0,0,n-1);
	
}
int le[110001];
int re2[110001];
int cc[110001][20];
int dd[110001][20];
int val[110001];
int tree2[4*200001];
int tree3[4*200001];

void build2(int no,int l,int r){
	if(l==r){
		tree2[no]=le[l];
		tree3[no]=re2[l];
	}
	else{
		int mid=(l+r)/2;
		build2(no*2+1,l,mid);
		build2(no*2+2,mid+1,r);
		tree2[no]=min(tree2[no*2+1],tree2[no*2+2]);
		tree3[no]=max(tree3[no*2+1],tree3[no*2+2]);
	}
}
int find(int no,int l,int r,int aa,int bb,int x){
	//find first with val less than x
	if(r<aa or l>bb or aa>bb){
		return -1;
	}
	if(l==r){
		if(tree2[no]<x){
			return l;
		}
		return -1;
	}
	if(tree2[no]>=x){
		return -1;
	}
	int mid=(l+r)/2;
	int xx=find(no*2+1,l,mid,aa,bb,x);
	if(xx>=0){
		return xx;
	}
	return find(no*2+2,mid+1,r,aa,bb,x);
}
int find2(int no,int l,int r,int aa,int bb,int x){
	//find first with val less than x
	if(r<aa or l>bb or aa>bb){
		return -1;
	}
	if(l==r){
		if(tree3[no]>x){
			return l;
		}
		return -1;
	}
	if(tree3[no]<=x){
		return -1;
	}
	int mid=(l+r)/2;
	int xx=find2(no*2+2,mid+1,r,aa,bb,x);
	if(xx>=0){
		return xx;
	}
	return find2(no*2+1,l,mid,aa,bb,x);
}
vector<int> adj[110001];
set<int> xa;
vector<pair<int,int>> yy;
int cot[110001*500];
int ll[110001*500];
int rr[110001*500];
int ba[110001];
int ne=0;
int update(int no,int l,int r,int i,int x){
	if(l==r){
		int sta=ne;
		ne++;
		ll[sta]=-1;
		rr[sta]=-1;
		cot[sta]=cot[no]+x;
		return sta;
	}
	else{
		int mid=(l+r)/2;
		int sta=ne;
		ne++;
		if(i<=mid){
			rr[sta]=rr[no];
			if(ll[no]==-1){
				ll[no]=ne;
				ne++;
				ll[ll[no]]=-1;
				rr[ll[no]]=-1;
				cot[ll[no]]=0;
			}
			ll[sta]=update(ll[no],l,mid,i,x);
		}
		else{
			ll[sta]=ll[no];

			if(rr[no]==-1){
				rr[no]=ne;
				ne++;
				rr[rr[no]]=-1;
				ll[rr[no]]=-1;
				cot[rr[no]]=0;
			}
			rr[sta]=update(rr[no],mid+1,r,i,x);
		}
		cot[sta]=0;
		if(ll[sta]>=0){
			cot[sta]+=cot[ll[sta]];
		}
		if(rr[sta]>=0){
			cot[sta]+=cot[rr[sta]];
		}
		return sta;
	}
}
int query5(int no,int l,int r,int aa,int bb){
	if(r<aa or l>bb or aa>bb){
		return 0;
	}
	if(aa<=l and r<=bb){
		return cot[no];
	}
	int mid=(l+r)/2;
	int su=0;
	if(ll[no]>=0){
		su+=query5(ll[no],l,mid,aa,bb);
	}
	if(rr[no]>=0){
		su+=query5(rr[no],mid+1,r,aa,bb);
	}
	return su;
}	
void dfs(int no,int par=-1){
	if(par==-1){
		par=ne;
		ll[ne]=-1;
		rr[ne]=-1;
		ne++;
	}
	else{
	}
	if(par!=-1){
		ba[no]=update(par,0,n-1,val[no],1);
	}
	else{
		ba[no]=par;

	}
	for(auto j:adj[no]){
		dfs(j,ba[no]);
	}
}
vector<int> adj2[110001];
int ba2[110001];
void dfs2(int no,int par=-1){
	if(par==-1){
		par=ne;
		ll[ne]=-1;
		rr[ne]=-1;
		ne++;
	}
	else{
	}
	if(par!=-1){
		ba2[no]=update(par,0,n-1,val[no],1);
	}
	else{
		ba2[no]=par;
	}
	for(auto j:adj2[no]){
		dfs2(j,ba2[no]);
	}
}
int ba3[110001];
vector<int> adj3[110001];
void dfs3(int no,int par=-1){
	if(par==-1){
		par=ne;
		ll[ne]=-1;
		rr[ne]=-1;
		ne++;
	}
	else{
	}
	if(par!=-1){
		ba3[no]=update(par,0,n-1,val[no-1],1);
	}
	else{
		ba3[no]=par;
	}
	for(auto j:adj3[no]){
		dfs3(j,ba3[no]);
	}
}
void rec(int l,int r){
	mm.clear();
	vector<pair<llo,llo>> ss;
	for(int i=r;i>=l;i--){
		while(ss.size()){
			if(ss.back().a<=it[i]){
				ss.pop_back();
			}
			else{
				break;
			}
		}
		re2[i]=n;
		if(ss.size()){
			re2[i]=ss.back().b;
		}
		ss.pb({it[i],i});
	}
	ss.clear();
	for(int i=l;i<=r;i++){
		while(ss.size()){
			if(ss.back().a<it[i]){
				ss.pop_back();
			}
			else{
				break;
			}
		}
		le[i]=-1;
		if(ss.size()){
			le[i]=ss.back().b;
		}
		ss.pb({it[i],i});
	}
	for(int i=0;i<n;i++){
		int x=it[i]-query(0,0,n-1,le[i]+1,i);
		int y=it[i]-query(0,0,n-1,i,re2[i]-1);
		val[i]=min(x,y);
		xa.insert(val[i]);
		mm.pb(min(x,y));
	}
	int ind7=0;
	map<int,int> kk;
	for(auto j:xa){
		kk[j]=ind7;
		yy.pb({j,ind7});
		ind7++;
	}
	for(int i=0;i<n;i++){
		val[i]=kk[val[i]];
	}
	for(int i=0;i<n;i++){
		adj3[i].pb(i+1);
	}
	dfs3(0);

	for(int i=0;i<n;i++){
		cc[i][0]=le[i];
		dd[i][0]=re2[i];
		adj[dd[i][0]].pb(i);
		if(cc[i][0]==-1){
			adj2[n].pb(i);
		}
		else{
			adj2[cc[i][0]].pb(i);
		}
	//	cout<<i<<":"<<le[i]<<endl;
	//	cout<<i<<":"<<re2[i]<<endl;
		if(re2[i]==n){
			dd[i][0]=-1;
		}
	}
	dfs(n);
	dfs2(n);

	for(int j=1;j<20;j++){
		for(int i=0;i<n;i++){
			if(cc[i][j-1]==-1){
				cc[i][j]=-1;
			}
			else{
				cc[i][j]=cc[cc[i][j-1]][j-1];
			}
		}
	}
	for(int j=1;j<20;j++){
		for(int i=0;i<n;i++){
			if(dd[i][j-1]==-1){
				dd[i][j]=-1;
			}
			else{
				dd[i][j]=dd[dd[i][j-1]][j-1];
			}
		}
	}
	build2(0,0,n-1);
	sort(mm.begin(),mm.end());

}

int max_towers(int l, int r, int d) {
	if(st==0){
		rec(0,n-1);
		st=1;
	}
	int de=yy.size();
	for(int j=19;j>=0;j--){
		if(de-(1<<j)>=0){
			if(yy[de-(1<<j)].a>=d){
				de-=(1<<j);
			}
		}	
	}
	if(de==yy.size()){
		return 1;
	}
	llo low=mm.size();
	llo su=0;
	/*for(int i=l;i<=r;i++){
		if(val[i]>=de){
			su++;
		}
	}*/
	su=query5(ba3[r+1],0,n-1,de,n-1)-query5(ba3[l],0,n-1,de,n-1);
	int ind=find(0,0,n-1,l,r,l);
	int ind2=ind;
	for(int j=19;j>=0;j--){
		if(dd[ind2][j]<=r and dd[ind2][j]>=0){
			ind2=dd[ind2][j];
		}
	}
	//vector<llo> ss;
	int ind3=-1;
	if(query(0,0,n-1,l,ind-1)>it[ind]-d){
		ind3=ind;
		for(int j=19;j>=0;j--){
			if(dd[ind][j]<=r and dd[ind][j]>=0){
				if(query(0,0,n-1,l,dd[ind][j]-1)>it[dd[ind][j]]-d){
					ind=dd[ind][j];
				}
			}
		}		
		llo zot=query5(ba[ind3],0,n-1,de,n-1);
		zot-=query5(ba[re2[ind]],0,n-1,de,n-1);
		su-=zot;
		//ss.pb(ind);

	}
	pair<int,int> ll={ind3,ind};
	//from ind3 to ind
	ind=-1;
	ind=find2(0,0,n-1,l,r,r);

	ind3=-1;
	if(query(0,0,n-1,ind+1,r)<=it[ind]-d){
	}
	else{
		ind3=ind;
		for(int j=19;j>=0;j--){
			if(cc[ind][j]>=l){
				if(query(0,0,n-1,cc[ind][j]+1,r)>it[cc[ind][j]]-d){
					ind=cc[ind][j];
				}
			}
		}
		llo zot=query5(ba2[ind3],0,n-1,de,n-1);
		if(cc[ind][0]==-1){
			zot-=query5(ba2[n],0,n-1,de,n-1);
		}
		else{
			zot-=query5(ba2[cc[ind][0]],0,n-1,de,n-1);
		}
		su-=zot;

	}
	pair<int,int> rr={ind3,ind};
	if(ll.a>=0 and rr.a>=0){
		if(rr.b==ind2 and ll.b==ind2){
			if(val[rr.b]>=de){
				su++;
			}
		}
	}
	su++;
	return su;
}

Compilation message

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:366:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  366 |  if(de==yy.size()){
      |     ~~^~~~~~~~~~~
towers.cpp:369:6: warning: unused variable 'low' [-Wunused-variable]
  369 |  llo low=mm.size();
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 659 ms 64808 KB Output is correct
2 Correct 1633 ms 107548 KB Output is correct
3 Correct 1612 ms 107576 KB Output is correct
4 Correct 689 ms 107656 KB Output is correct
5 Correct 790 ms 107628 KB Output is correct
6 Correct 1530 ms 107668 KB Output is correct
7 Correct 840 ms 107652 KB Output is correct
8 Correct 4 ms 8144 KB Output is correct
9 Correct 5 ms 9700 KB Output is correct
10 Correct 6 ms 9680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 6 ms 9680 KB Output is correct
3 Correct 6 ms 9680 KB Output is correct
4 Correct 6 ms 9840 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9680 KB Output is correct
9 Correct 5 ms 9680 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9680 KB Output is correct
12 Correct 3 ms 8100 KB Output is correct
13 Correct 5 ms 9680 KB Output is correct
14 Correct 6 ms 9680 KB Output is correct
15 Correct 6 ms 9680 KB Output is correct
16 Correct 6 ms 9848 KB Output is correct
17 Correct 6 ms 9756 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 5 ms 9680 KB Output is correct
20 Correct 6 ms 9680 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 6 ms 9808 KB Output is correct
23 Correct 5 ms 9692 KB Output is correct
24 Correct 5 ms 9680 KB Output is correct
25 Correct 5 ms 8784 KB Output is correct
26 Correct 6 ms 9680 KB Output is correct
27 Correct 6 ms 9680 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9800 KB Output is correct
30 Correct 6 ms 9808 KB Output is correct
31 Correct 8 ms 9864 KB Output is correct
32 Correct 5 ms 9680 KB Output is correct
33 Correct 5 ms 9692 KB Output is correct
34 Correct 5 ms 9680 KB Output is correct
35 Correct 6 ms 9680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 6 ms 9680 KB Output is correct
3 Correct 6 ms 9680 KB Output is correct
4 Correct 6 ms 9840 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9680 KB Output is correct
9 Correct 5 ms 9680 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9680 KB Output is correct
12 Correct 3 ms 8100 KB Output is correct
13 Correct 5 ms 9680 KB Output is correct
14 Correct 6 ms 9680 KB Output is correct
15 Correct 6 ms 9680 KB Output is correct
16 Correct 6 ms 9848 KB Output is correct
17 Correct 6 ms 9756 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 5 ms 9680 KB Output is correct
20 Correct 6 ms 9680 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 6 ms 9808 KB Output is correct
23 Correct 5 ms 9692 KB Output is correct
24 Correct 5 ms 9680 KB Output is correct
25 Correct 5 ms 8784 KB Output is correct
26 Correct 6 ms 9680 KB Output is correct
27 Correct 6 ms 9680 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9800 KB Output is correct
30 Correct 6 ms 9808 KB Output is correct
31 Correct 8 ms 9864 KB Output is correct
32 Correct 5 ms 9680 KB Output is correct
33 Correct 5 ms 9692 KB Output is correct
34 Correct 5 ms 9680 KB Output is correct
35 Correct 6 ms 9680 KB Output is correct
36 Correct 103 ms 73096 KB Output is correct
37 Correct 173 ms 112124 KB Output is correct
38 Correct 176 ms 112088 KB Output is correct
39 Correct 208 ms 117116 KB Output is correct
40 Correct 199 ms 117136 KB Output is correct
41 Correct 193 ms 117336 KB Output is correct
42 Correct 185 ms 117020 KB Output is correct
43 Correct 115 ms 107680 KB Output is correct
44 Correct 115 ms 107668 KB Output is correct
45 Correct 127 ms 107256 KB Output is correct
46 Correct 115 ms 107068 KB Output is correct
47 Correct 166 ms 112128 KB Output is correct
48 Correct 190 ms 117100 KB Output is correct
49 Correct 190 ms 117096 KB Output is correct
50 Correct 115 ms 107704 KB Output is correct
51 Correct 119 ms 107692 KB Output is correct
52 Correct 170 ms 112076 KB Output is correct
53 Correct 216 ms 116880 KB Output is correct
54 Correct 196 ms 116996 KB Output is correct
55 Correct 116 ms 107636 KB Output is correct
56 Correct 138 ms 107624 KB Output is correct
57 Correct 184 ms 108764 KB Output is correct
58 Correct 171 ms 112064 KB Output is correct
59 Correct 166 ms 112172 KB Output is correct
60 Correct 194 ms 117160 KB Output is correct
61 Correct 189 ms 117052 KB Output is correct
62 Correct 201 ms 117104 KB Output is correct
63 Correct 199 ms 117184 KB Output is correct
64 Correct 112 ms 107636 KB Output is correct
65 Correct 124 ms 107708 KB Output is correct
66 Correct 122 ms 107132 KB Output is correct
67 Correct 127 ms 107640 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1166 ms 111388 KB Output is correct
2 Correct 1479 ms 112276 KB Output is correct
3 Correct 1414 ms 112080 KB Output is correct
4 Correct 1641 ms 116968 KB Output is correct
5 Correct 1575 ms 117128 KB Output is correct
6 Correct 1588 ms 117020 KB Output is correct
7 Correct 1616 ms 117524 KB Output is correct
8 Correct 774 ms 107700 KB Output is correct
9 Correct 781 ms 107692 KB Output is correct
10 Correct 1628 ms 107484 KB Output is correct
11 Correct 1399 ms 107256 KB Output is correct
12 Correct 1673 ms 107624 KB Output is correct
13 Correct 837 ms 107700 KB Output is correct
14 Correct 4 ms 8144 KB Output is correct
15 Correct 6 ms 9680 KB Output is correct
16 Correct 5 ms 9680 KB Output is correct
17 Correct 172 ms 112192 KB Output is correct
18 Correct 204 ms 117084 KB Output is correct
19 Correct 192 ms 116888 KB Output is correct
20 Correct 115 ms 107744 KB Output is correct
21 Correct 115 ms 107680 KB Output is correct
22 Correct 171 ms 112064 KB Output is correct
23 Correct 198 ms 116908 KB Output is correct
24 Correct 187 ms 116904 KB Output is correct
25 Correct 114 ms 107680 KB Output is correct
26 Correct 130 ms 107584 KB Output is correct
27 Correct 6 ms 9772 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9796 KB Output is correct
30 Correct 5 ms 9680 KB Output is correct
31 Correct 5 ms 9664 KB Output is correct
32 Correct 6 ms 9680 KB Output is correct
33 Correct 6 ms 9808 KB Output is correct
34 Correct 6 ms 9808 KB Output is correct
35 Correct 5 ms 9680 KB Output is correct
36 Correct 5 ms 9628 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 326 ms 31272 KB Output is correct
2 Correct 1147 ms 112152 KB Output is correct
3 Correct 1040 ms 112116 KB Output is correct
4 Correct 1274 ms 117028 KB Output is correct
5 Correct 1268 ms 117244 KB Output is correct
6 Correct 1230 ms 117324 KB Output is correct
7 Correct 1204 ms 116928 KB Output is correct
8 Correct 652 ms 107628 KB Output is correct
9 Correct 691 ms 107740 KB Output is correct
10 Correct 1004 ms 107200 KB Output is correct
11 Correct 958 ms 107208 KB Output is correct
12 Correct 226 ms 112080 KB Output is correct
13 Correct 189 ms 116800 KB Output is correct
14 Correct 190 ms 117012 KB Output is correct
15 Correct 112 ms 107708 KB Output is correct
16 Correct 117 ms 107564 KB Output is correct
17 Correct 163 ms 108664 KB Output is correct
18 Correct 178 ms 112024 KB Output is correct
19 Correct 177 ms 112148 KB Output is correct
20 Correct 203 ms 117128 KB Output is correct
21 Correct 222 ms 117092 KB Output is correct
22 Correct 188 ms 117120 KB Output is correct
23 Correct 193 ms 117268 KB Output is correct
24 Correct 142 ms 107660 KB Output is correct
25 Correct 120 ms 107704 KB Output is correct
26 Correct 133 ms 107100 KB Output is correct
27 Correct 120 ms 107624 KB Output is correct
28 Correct 6 ms 9680 KB Output is correct
29 Correct 6 ms 9808 KB Output is correct
30 Correct 6 ms 9808 KB Output is correct
31 Correct 5 ms 9668 KB Output is correct
32 Correct 5 ms 9680 KB Output is correct
33 Correct 5 ms 8784 KB Output is correct
34 Correct 6 ms 9680 KB Output is correct
35 Correct 6 ms 9680 KB Output is correct
36 Correct 6 ms 9808 KB Output is correct
37 Correct 6 ms 9808 KB Output is correct
38 Correct 6 ms 9752 KB Output is correct
39 Correct 6 ms 9808 KB Output is correct
40 Correct 5 ms 9684 KB Output is correct
41 Correct 5 ms 9680 KB Output is correct
42 Correct 6 ms 9680 KB Output is correct
43 Correct 6 ms 9680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 8400 KB Output is correct
2 Correct 6 ms 9680 KB Output is correct
3 Correct 6 ms 9680 KB Output is correct
4 Correct 6 ms 9840 KB Output is correct
5 Correct 6 ms 9808 KB Output is correct
6 Correct 6 ms 9808 KB Output is correct
7 Correct 6 ms 9808 KB Output is correct
8 Correct 5 ms 9680 KB Output is correct
9 Correct 5 ms 9680 KB Output is correct
10 Correct 5 ms 9680 KB Output is correct
11 Correct 5 ms 9680 KB Output is correct
12 Correct 3 ms 8100 KB Output is correct
13 Correct 5 ms 9680 KB Output is correct
14 Correct 6 ms 9680 KB Output is correct
15 Correct 6 ms 9680 KB Output is correct
16 Correct 6 ms 9848 KB Output is correct
17 Correct 6 ms 9756 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 5 ms 9680 KB Output is correct
20 Correct 6 ms 9680 KB Output is correct
21 Correct 6 ms 9808 KB Output is correct
22 Correct 6 ms 9808 KB Output is correct
23 Correct 5 ms 9692 KB Output is correct
24 Correct 5 ms 9680 KB Output is correct
25 Correct 5 ms 8784 KB Output is correct
26 Correct 6 ms 9680 KB Output is correct
27 Correct 6 ms 9680 KB Output is correct
28 Correct 6 ms 9808 KB Output is correct
29 Correct 6 ms 9800 KB Output is correct
30 Correct 6 ms 9808 KB Output is correct
31 Correct 8 ms 9864 KB Output is correct
32 Correct 5 ms 9680 KB Output is correct
33 Correct 5 ms 9692 KB Output is correct
34 Correct 5 ms 9680 KB Output is correct
35 Correct 6 ms 9680 KB Output is correct
36 Correct 103 ms 73096 KB Output is correct
37 Correct 173 ms 112124 KB Output is correct
38 Correct 176 ms 112088 KB Output is correct
39 Correct 208 ms 117116 KB Output is correct
40 Correct 199 ms 117136 KB Output is correct
41 Correct 193 ms 117336 KB Output is correct
42 Correct 185 ms 117020 KB Output is correct
43 Correct 115 ms 107680 KB Output is correct
44 Correct 115 ms 107668 KB Output is correct
45 Correct 127 ms 107256 KB Output is correct
46 Correct 115 ms 107068 KB Output is correct
47 Correct 166 ms 112128 KB Output is correct
48 Correct 190 ms 117100 KB Output is correct
49 Correct 190 ms 117096 KB Output is correct
50 Correct 115 ms 107704 KB Output is correct
51 Correct 119 ms 107692 KB Output is correct
52 Correct 170 ms 112076 KB Output is correct
53 Correct 216 ms 116880 KB Output is correct
54 Correct 196 ms 116996 KB Output is correct
55 Correct 116 ms 107636 KB Output is correct
56 Correct 138 ms 107624 KB Output is correct
57 Correct 184 ms 108764 KB Output is correct
58 Correct 171 ms 112064 KB Output is correct
59 Correct 166 ms 112172 KB Output is correct
60 Correct 194 ms 117160 KB Output is correct
61 Correct 189 ms 117052 KB Output is correct
62 Correct 201 ms 117104 KB Output is correct
63 Correct 199 ms 117184 KB Output is correct
64 Correct 112 ms 107636 KB Output is correct
65 Correct 124 ms 107708 KB Output is correct
66 Correct 122 ms 107132 KB Output is correct
67 Correct 127 ms 107640 KB Output is correct
68 Correct 1166 ms 111388 KB Output is correct
69 Correct 1479 ms 112276 KB Output is correct
70 Correct 1414 ms 112080 KB Output is correct
71 Correct 1641 ms 116968 KB Output is correct
72 Correct 1575 ms 117128 KB Output is correct
73 Correct 1588 ms 117020 KB Output is correct
74 Correct 1616 ms 117524 KB Output is correct
75 Correct 774 ms 107700 KB Output is correct
76 Correct 781 ms 107692 KB Output is correct
77 Correct 1628 ms 107484 KB Output is correct
78 Correct 1399 ms 107256 KB Output is correct
79 Correct 1673 ms 107624 KB Output is correct
80 Correct 837 ms 107700 KB Output is correct
81 Correct 4 ms 8144 KB Output is correct
82 Correct 6 ms 9680 KB Output is correct
83 Correct 5 ms 9680 KB Output is correct
84 Correct 172 ms 112192 KB Output is correct
85 Correct 204 ms 117084 KB Output is correct
86 Correct 192 ms 116888 KB Output is correct
87 Correct 115 ms 107744 KB Output is correct
88 Correct 115 ms 107680 KB Output is correct
89 Correct 171 ms 112064 KB Output is correct
90 Correct 198 ms 116908 KB Output is correct
91 Correct 187 ms 116904 KB Output is correct
92 Correct 114 ms 107680 KB Output is correct
93 Correct 130 ms 107584 KB Output is correct
94 Correct 6 ms 9772 KB Output is correct
95 Correct 6 ms 9808 KB Output is correct
96 Correct 6 ms 9796 KB Output is correct
97 Correct 5 ms 9680 KB Output is correct
98 Correct 5 ms 9664 KB Output is correct
99 Correct 6 ms 9680 KB Output is correct
100 Correct 6 ms 9808 KB Output is correct
101 Correct 6 ms 9808 KB Output is correct
102 Correct 5 ms 9680 KB Output is correct
103 Correct 5 ms 9628 KB Output is correct
104 Correct 1252 ms 100676 KB Output is correct
105 Correct 1465 ms 112080 KB Output is correct
106 Correct 1555 ms 112188 KB Output is correct
107 Correct 1392 ms 117100 KB Output is correct
108 Correct 1364 ms 117108 KB Output is correct
109 Correct 1310 ms 117136 KB Output is correct
110 Correct 1472 ms 117224 KB Output is correct
111 Correct 722 ms 107744 KB Output is correct
112 Correct 809 ms 107656 KB Output is correct
113 Correct 1595 ms 107356 KB Output is correct
114 Correct 1543 ms 106912 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 659 ms 64808 KB Output is correct
2 Correct 1633 ms 107548 KB Output is correct
3 Correct 1612 ms 107576 KB Output is correct
4 Correct 689 ms 107656 KB Output is correct
5 Correct 790 ms 107628 KB Output is correct
6 Correct 1530 ms 107668 KB Output is correct
7 Correct 840 ms 107652 KB Output is correct
8 Correct 4 ms 8144 KB Output is correct
9 Correct 5 ms 9700 KB Output is correct
10 Correct 6 ms 9680 KB Output is correct
11 Correct 4 ms 8400 KB Output is correct
12 Correct 6 ms 9680 KB Output is correct
13 Correct 6 ms 9680 KB Output is correct
14 Correct 6 ms 9840 KB Output is correct
15 Correct 6 ms 9808 KB Output is correct
16 Correct 6 ms 9808 KB Output is correct
17 Correct 6 ms 9808 KB Output is correct
18 Correct 5 ms 9680 KB Output is correct
19 Correct 5 ms 9680 KB Output is correct
20 Correct 5 ms 9680 KB Output is correct
21 Correct 5 ms 9680 KB Output is correct
22 Correct 3 ms 8100 KB Output is correct
23 Correct 5 ms 9680 KB Output is correct
24 Correct 6 ms 9680 KB Output is correct
25 Correct 6 ms 9680 KB Output is correct
26 Correct 6 ms 9848 KB Output is correct
27 Correct 6 ms 9756 KB Output is correct
28 Correct 5 ms 9680 KB Output is correct
29 Correct 5 ms 9680 KB Output is correct
30 Correct 6 ms 9680 KB Output is correct
31 Correct 6 ms 9808 KB Output is correct
32 Correct 6 ms 9808 KB Output is correct
33 Correct 5 ms 9692 KB Output is correct
34 Correct 5 ms 9680 KB Output is correct
35 Correct 5 ms 8784 KB Output is correct
36 Correct 6 ms 9680 KB Output is correct
37 Correct 6 ms 9680 KB Output is correct
38 Correct 6 ms 9808 KB Output is correct
39 Correct 6 ms 9800 KB Output is correct
40 Correct 6 ms 9808 KB Output is correct
41 Correct 8 ms 9864 KB Output is correct
42 Correct 5 ms 9680 KB Output is correct
43 Correct 5 ms 9692 KB Output is correct
44 Correct 5 ms 9680 KB Output is correct
45 Correct 6 ms 9680 KB Output is correct
46 Correct 103 ms 73096 KB Output is correct
47 Correct 173 ms 112124 KB Output is correct
48 Correct 176 ms 112088 KB Output is correct
49 Correct 208 ms 117116 KB Output is correct
50 Correct 199 ms 117136 KB Output is correct
51 Correct 193 ms 117336 KB Output is correct
52 Correct 185 ms 117020 KB Output is correct
53 Correct 115 ms 107680 KB Output is correct
54 Correct 115 ms 107668 KB Output is correct
55 Correct 127 ms 107256 KB Output is correct
56 Correct 115 ms 107068 KB Output is correct
57 Correct 166 ms 112128 KB Output is correct
58 Correct 190 ms 117100 KB Output is correct
59 Correct 190 ms 117096 KB Output is correct
60 Correct 115 ms 107704 KB Output is correct
61 Correct 119 ms 107692 KB Output is correct
62 Correct 170 ms 112076 KB Output is correct
63 Correct 216 ms 116880 KB Output is correct
64 Correct 196 ms 116996 KB Output is correct
65 Correct 116 ms 107636 KB Output is correct
66 Correct 138 ms 107624 KB Output is correct
67 Correct 184 ms 108764 KB Output is correct
68 Correct 171 ms 112064 KB Output is correct
69 Correct 166 ms 112172 KB Output is correct
70 Correct 194 ms 117160 KB Output is correct
71 Correct 189 ms 117052 KB Output is correct
72 Correct 201 ms 117104 KB Output is correct
73 Correct 199 ms 117184 KB Output is correct
74 Correct 112 ms 107636 KB Output is correct
75 Correct 124 ms 107708 KB Output is correct
76 Correct 122 ms 107132 KB Output is correct
77 Correct 127 ms 107640 KB Output is correct
78 Correct 1166 ms 111388 KB Output is correct
79 Correct 1479 ms 112276 KB Output is correct
80 Correct 1414 ms 112080 KB Output is correct
81 Correct 1641 ms 116968 KB Output is correct
82 Correct 1575 ms 117128 KB Output is correct
83 Correct 1588 ms 117020 KB Output is correct
84 Correct 1616 ms 117524 KB Output is correct
85 Correct 774 ms 107700 KB Output is correct
86 Correct 781 ms 107692 KB Output is correct
87 Correct 1628 ms 107484 KB Output is correct
88 Correct 1399 ms 107256 KB Output is correct
89 Correct 1673 ms 107624 KB Output is correct
90 Correct 837 ms 107700 KB Output is correct
91 Correct 4 ms 8144 KB Output is correct
92 Correct 6 ms 9680 KB Output is correct
93 Correct 5 ms 9680 KB Output is correct
94 Correct 172 ms 112192 KB Output is correct
95 Correct 204 ms 117084 KB Output is correct
96 Correct 192 ms 116888 KB Output is correct
97 Correct 115 ms 107744 KB Output is correct
98 Correct 115 ms 107680 KB Output is correct
99 Correct 171 ms 112064 KB Output is correct
100 Correct 198 ms 116908 KB Output is correct
101 Correct 187 ms 116904 KB Output is correct
102 Correct 114 ms 107680 KB Output is correct
103 Correct 130 ms 107584 KB Output is correct
104 Correct 6 ms 9772 KB Output is correct
105 Correct 6 ms 9808 KB Output is correct
106 Correct 6 ms 9796 KB Output is correct
107 Correct 5 ms 9680 KB Output is correct
108 Correct 5 ms 9664 KB Output is correct
109 Correct 6 ms 9680 KB Output is correct
110 Correct 6 ms 9808 KB Output is correct
111 Correct 6 ms 9808 KB Output is correct
112 Correct 5 ms 9680 KB Output is correct
113 Correct 5 ms 9628 KB Output is correct
114 Correct 326 ms 31272 KB Output is correct
115 Correct 1147 ms 112152 KB Output is correct
116 Correct 1040 ms 112116 KB Output is correct
117 Correct 1274 ms 117028 KB Output is correct
118 Correct 1268 ms 117244 KB Output is correct
119 Correct 1230 ms 117324 KB Output is correct
120 Correct 1204 ms 116928 KB Output is correct
121 Correct 652 ms 107628 KB Output is correct
122 Correct 691 ms 107740 KB Output is correct
123 Correct 1004 ms 107200 KB Output is correct
124 Correct 958 ms 107208 KB Output is correct
125 Correct 226 ms 112080 KB Output is correct
126 Correct 189 ms 116800 KB Output is correct
127 Correct 190 ms 117012 KB Output is correct
128 Correct 112 ms 107708 KB Output is correct
129 Correct 117 ms 107564 KB Output is correct
130 Correct 163 ms 108664 KB Output is correct
131 Correct 178 ms 112024 KB Output is correct
132 Correct 177 ms 112148 KB Output is correct
133 Correct 203 ms 117128 KB Output is correct
134 Correct 222 ms 117092 KB Output is correct
135 Correct 188 ms 117120 KB Output is correct
136 Correct 193 ms 117268 KB Output is correct
137 Correct 142 ms 107660 KB Output is correct
138 Correct 120 ms 107704 KB Output is correct
139 Correct 133 ms 107100 KB Output is correct
140 Correct 120 ms 107624 KB Output is correct
141 Correct 6 ms 9680 KB Output is correct
142 Correct 6 ms 9808 KB Output is correct
143 Correct 6 ms 9808 KB Output is correct
144 Correct 5 ms 9668 KB Output is correct
145 Correct 5 ms 9680 KB Output is correct
146 Correct 5 ms 8784 KB Output is correct
147 Correct 6 ms 9680 KB Output is correct
148 Correct 6 ms 9680 KB Output is correct
149 Correct 6 ms 9808 KB Output is correct
150 Correct 6 ms 9808 KB Output is correct
151 Correct 6 ms 9752 KB Output is correct
152 Correct 6 ms 9808 KB Output is correct
153 Correct 5 ms 9684 KB Output is correct
154 Correct 5 ms 9680 KB Output is correct
155 Correct 6 ms 9680 KB Output is correct
156 Correct 6 ms 9680 KB Output is correct
157 Correct 1252 ms 100676 KB Output is correct
158 Correct 1465 ms 112080 KB Output is correct
159 Correct 1555 ms 112188 KB Output is correct
160 Correct 1392 ms 117100 KB Output is correct
161 Correct 1364 ms 117108 KB Output is correct
162 Correct 1310 ms 117136 KB Output is correct
163 Correct 1472 ms 117224 KB Output is correct
164 Correct 722 ms 107744 KB Output is correct
165 Correct 809 ms 107656 KB Output is correct
166 Correct 1595 ms 107356 KB Output is correct
167 Correct 1543 ms 106912 KB Output is correct
168 Correct 4 ms 8144 KB Output is correct
169 Correct 891 ms 43224 KB Output is correct
170 Correct 1750 ms 112228 KB Output is correct
171 Correct 1981 ms 111968 KB Output is correct
172 Correct 1663 ms 117032 KB Output is correct
173 Correct 1609 ms 117036 KB Output is correct
174 Correct 1643 ms 117056 KB Output is correct
175 Correct 1591 ms 116932 KB Output is correct
176 Correct 866 ms 107748 KB Output is correct
177 Correct 793 ms 107708 KB Output is correct
178 Correct 1426 ms 107096 KB Output is correct
179 Correct 1246 ms 107668 KB Output is correct