QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#118596#4303. New Levelxyloph0nex17AC ✓98ms39940kbC++142.0kb2023-07-03 18:14:012023-07-03 18:14:03

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-03 18:14:03]
  • 评测
  • 测评结果:AC
  • 用时:98ms
  • 内存:39940kb
  • [2023-07-03 18:14:01]
  • 提交

answer

//El Psy Kongroo
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ri int
using namespace std ;
template <typename T>
inline void read(T&x){
	x = 0 ; char c = getchar() ; bool flg = 1 ; while(c > '9' || c < '0'){if(c == '-')flg = 0 ; c = getchar() ;}
	while(c >= '0' && c <= '9'){x = (x << 1) + (x << 3) + (c ^ 48) ; c = getchar() ;} x = flg ? x : -x ;
}
template <typename T,typename ...Args>
inline void read(T&x,Args&...args){read(x),read(args...);}
bool m_bg ;
const int N = 1e6 + 10 , inf = 2e9 ;
int n,m,k,c[N],__fa[N] ;
inline int getf(int x){return __fa[x] == x ? x : __fa[x] = getf(__fa[x]) ;}
inline void merge(int x,int y){x = getf(x) , y = getf(y) ; if(x == y)return ; __fa[x] = y ;}
inline int neib(int x,int y){return ((c[x]+1)%k==c[y])||((c[y]+1)%k==c[x]) ;}
struct line{int u,v ;}L[N] ;
struct star{int to,pre,w ;}e[N] ; int head[N],strn=1 ;
void add(int u,int v,int w){e[++strn].to=v,e[strn].w=w,e[strn].pre=head[u],head[u]=strn ;}
#define pii pair<int,int>
priority_queue<pii,vector<pii>,greater<pii>>q ;
int dis[N],vis[N] ;
void djk(){
	for(ri i = 1 ; i <= n ; i++)dis[i] = inf ; dis[getf(1)] = 0 ; 
	q.push({0,getf(1)}) ; while(!q.empty()){
		int u = q.top().second ; q.pop() ;
		if(vis[u])continue ; vis[u] = 1 ;
		//cout<<u<<"!"<<endl ;
		for(ri i = head[u] , v ; i ; i = e[i].pre){
			v = getf(e[i].to) ; //cout<<v<<"!"<<endl ;
			if(dis[v]>dis[u]+e[i].w)dis[v]=dis[u]+e[i].w,q.push({dis[v],v}) ;
		}
	}
}
bool m_ed ;
signed main(){
	//freopen("past.in","r",stdin) ; freopen("past.out","w",stdout) ;
	read(n,m,k) ; for(ri i = 1 ; i <= n ; i++)read(c[i]),__fa[i]=i ;
	for(ri i = 1 , u , v ; i <= m ; i++){
		read(u,v) ; L[i]={u,v} ;
		if(neib(u,v))merge(u,v) ;
	}
	for(ri i = 1 , u , v , fu , fv ; i <= m ; i++){
		u = L[i].u , v = L[i].v ; fu = getf(u) , fv = getf(v) ; if(fu==fv)continue ;
		add(fu,fv,(c[u]-c[v]-1+k)%k) ; add(fv,fu,(c[v]-c[u]-1+k)%k) ;
	}
	djk() ;
	for(ri i = 1 ; i <= n ; i++)printf("%d ",(c[i]+dis[getf(i)])%k+1) ;
	return 0 ;
}
/*
4 4 4
0 1 2 0
1 2
1 3
2 3
3 4

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 15884kb

input:

4 4 4
1 2 3 1
1 2
1 3
2 3
3 4

output:

2 3 4 3 

result:

ok n=4, m=4, k=4

Test #2:

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

input:

10 9 3
3 2 3 3 1 2 3 1 1 2
2 1
3 2
4 2
5 3
6 5
7 6
8 6
9 7
10 9

output:

1 3 2 2 3 1 3 3 1 2 

result:

ok n=10, m=9, k=3

Test #3:

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

input:

239 238 10
6 1 2 10 9 1 8 10 1 10 6 4 5 2 7 8 4 9 7 5 1 3 2 8 1 7 3 4 6 4 2 6 3 10 3 10 5 1 8 8 1 1 2 3 5 5 5 9 3 8 3 4 7 10 7 5 7 8 2 6 8 10 3 3 2 1 7 5 1 4 4 1 9 9 4 2 10 1 6 10 5 3 8 4 4 10 4 4 2 9 9 6 6 8 2 3 2 4 8 5 10 10 3 3 5 1 4 8 4 2 3 6 10 4 10 2 8 2 2 5 7 5 3 3 8 1 7 10 2 8 2 6 3 10 6 5 9...

output:

7 6 7 6 6 6 6 5 7 5 6 6 4 4 7 5 3 6 2 1 5 2 6 4 3 2 3 4 2 2 1 3 3 1 2 2 2 3 1 1 1 10 2 10 9 1 9 8 10 7 10 6 6 5 4 9 4 7 3 2 5 3 1 1 10 4 10 9 9 8 8 8 7 7 6 5 5 6 5 5 4 4 4 3 5 3 3 2 2 2 2 1 1 1 1 1 10 10 9 8 9 9 8 8 8 10 7 7 9 6 8 6 5 9 8 5 4 7 7 4 6 6 5 8 4 4 4 3 3 2 2 3 4 1 1 10 10 10 9 10 8 1 9 9...

result:

ok n=239, m=238, k=10

Test #4:

score: 0
Accepted
time: 3ms
memory: 16008kb

input:

2392 2391 100
89 13 96 29 35 81 10 62 30 4 46 56 15 37 61 8 45 47 5 29 23 64 98 50 18 34 28 24 20 24 10 43 34 28 64 100 61 22 68 37 61 49 37 74 64 53 1 84 54 30 46 25 21 31 96 49 74 19 4 10 29 72 27 48 28 99 74 8 32 89 46 68 73 87 41 72 25 2 27 66 77 90 24 78 65 34 67 25 11 9 16 17 87 2 56 58 48 56 ...

output:

90 89 88 88 87 88 87 86 87 88 87 86 85 87 84 85 86 85 86 85 89 86 89 85 88 85 87 85 88 85 87 84 86 87 88 85 85 83 83 84 86 84 84 87 85 82 85 87 87 84 87 85 89 86 86 87 83 85 86 83 82 84 84 85 83 84 82 85 87 85 84 83 86 81 84 86 82 86 83 81 86 81 83 86 85 81 85 86 88 86 86 89 83 84 82 84 86 89 85 87 ...

result:

ok n=2392, m=2391, k=100

Test #5:

score: 0
Accepted
time: 3ms
memory: 15988kb

input:

4 3 3
1 3 1 2
2 1
3 2
4 2

output:

2 1 2 3 

result:

ok n=4, m=3, k=3

Test #6:

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

input:

5000 4999 215
75 104 70 136 199 28 108 67 92 90 200 35 184 21 81 200 48 193 172 143 109 43 89 94 195 149 176 198 96 101 199 207 112 29 7 123 59 3 14 38 99 152 188 15 188 179 47 190 199 117 3 63 187 77 14 166 41 8 7 209 211 95 6 80 174 135 211 95 211 189 180 118 210 20 111 24 192 67 129 116 182 17 17...

output:

76 75 75 74 73 74 72 74 72 73 71 75 74 74 75 73 72 74 71 70 69 71 73 73 71 71 72 71 70 70 73 68 74 69 74 72 72 71 72 75 73 72 69 75 69 72 67 74 72 74 73 73 74 69 75 74 73 72 73 68 71 74 68 72 71 66 73 73 72 72 73 69 73 68 73 72 72 68 71 71 71 68 72 68 73 73 65 66 71 71 70 71 71 71 70 67 73 70 71 71 ...

result:

ok n=5000, m=4999, k=215

Test #7:

score: 0
Accepted
time: 3ms
memory: 15896kb

input:

5000 4999 215
155 162 166 204 39 176 58 184 65 113 129 76 118 27 143 103 22 1 209 135 32 117 55 152 197 66 199 5 186 166 53 101 34 91 148 2 70 51 202 80 1 41 31 143 44 102 145 13 90 100 163 185 211 77 45 48 26 123 4 104 20 168 154 142 90 153 149 163 38 172 29 133 62 189 107 89 37 210 57 24 25 55 123...

output:

156 155 154 153 152 151 150 149 148 147 146 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 78 ...

result:

ok n=5000, m=4999, k=215

Test #8:

score: 0
Accepted
time: 15ms
memory: 20344kb

input:

100000 99999 215
144 87 149 51 25 51 108 78 135 17 73 188 186 148 9 184 206 1 35 53 29 31 200 78 63 136 158 54 153 103 71 83 60 94 89 7 215 85 150 179 210 130 161 112 93 213 106 189 162 43 173 141 185 192 160 210 196 197 185 33 136 85 103 150 197 140 202 45 51 133 177 16 66 106 70 140 35 66 14 112 1...

output:

145 144 143 143 142 144 143 144 142 141 143 141 141 143 140 143 142 144 141 141 140 143 140 142 141 141 140 141 142 143 139 138 141 140 139 142 143 140 137 142 142 142 141 142 141 142 143 140 142 140 140 138 139 142 142 140 137 141 139 139 141 143 137 141 140 140 141 139 144 142 142 139 143 140 141 ...

result:

ok n=100000, m=99999, k=215

Test #9:

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

input:

100000 99999 215
8 183 153 16 17 143 160 152 91 68 8 161 194 91 107 15 206 155 125 10 109 22 77 17 151 148 175 139 182 167 153 115 16 113 58 182 191 203 215 106 34 159 17 182 139 44 30 129 105 134 57 157 32 56 214 5 62 180 175 61 120 15 214 97 103 24 209 194 127 87 204 89 156 2 36 74 114 163 206 97 ...

output:

9 8 7 6 7 6 5 4 3 2 1 215 214 213 212 211 210 209 208 207 206 205 204 203 202 201 200 199 198 197 196 195 194 193 192 191 190 189 188 187 186 185 184 183 182 181 180 179 178 177 176 175 174 173 172 171 170 169 168 167 166 165 164 163 162 161 160 159 158 157 156 155 154 153 152 151 150 149 148 147 14...

result:

ok n=100000, m=99999, k=215

Test #10:

score: 0
Accepted
time: 51ms
memory: 27280kb

input:

239239 239238 239
146 41 60 184 200 183 12 18 119 159 195 222 203 34 50 160 207 170 130 87 232 87 92 221 84 33 38 237 187 102 50 204 3 135 227 23 110 116 215 28 27 238 239 91 153 214 233 193 77 167 203 167 83 200 214 234 68 188 232 197 67 17 210 199 17 222 103 213 99 212 159 76 134 182 89 134 44 92 ...

output:

147 146 146 145 144 145 146 145 145 144 145 145 144 144 144 144 143 142 145 143 143 143 145 143 141 142 144 144 143 143 141 144 143 145 144 144 143 142 141 145 144 140 142 140 144 140 143 143 143 143 142 146 142 143 144 141 144 143 141 145 144 143 145 144 143 143 143 142 142 141 144 142 141 142 142 ...

result:

ok n=239239, m=239238, k=239

Test #11:

score: 0
Accepted
time: 14ms
memory: 18332kb

input:

73223 73222 456
176 375 93 323 28 186 232 176 6 374 42 15 169 308 221 137 388 221 345 86 170 251 432 288 394 21 122 351 430 78 216 133 119 278 100 163 46 278 294 234 68 239 64 202 41 194 410 253 352 153 333 363 120 379 235 286 412 299 20 71 139 369 306 390 327 78 165 245 313 275 6 140 274 417 335 24...

output:

177 176 176 175 174 173 175 175 176 176 173 172 175 176 175 172 175 174 171 172 173 175 172 172 175 175 175 174 172 175 174 170 172 171 171 175 172 174 174 172 173 174 171 175 171 175 173 174 173 170 174 171 176 170 174 174 173 172 174 173 170 172 173 173 171 169 174 175 170 171 173 169 171 171 173 ...

result:

ok n=73223, m=73222, k=456

Test #12:

score: 0
Accepted
time: 70ms
memory: 37068kb

input:

500000 499999 120
120 109 52 88 118 102 96 49 54 40 65 119 104 14 83 86 70 71 108 13 89 86 79 93 2 3 84 120 10 22 116 111 41 2 25 18 65 70 99 99 107 21 75 98 24 95 106 40 40 77 26 103 53 63 35 120 80 56 38 35 82 24 108 26 35 88 47 53 29 8 15 53 89 67 109 69 64 9 51 3 2 99 48 11 82 90 47 91 47 31 9 7...

output:

1 120 119 120 120 119 118 117 118 118 119 118 117 117 118 119 119 119 116 117 117 116 118 118 118 119 115 114 119 118 116 117 118 120 117 117 117 117 115 113 116 118 117 116 116 115 114 118 119 119 117 116 117 115 118 119 116 116 115 116 115 118 116 117 117 114 115 119 115 115 119 116 118 118 120 11...

result:

ok n=500000, m=499999, k=120

Test #13:

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

input:

3 2 2
1 2 2
2 1
3 1

output:

2 1 1 

result:

ok n=3, m=2, k=2

Test #14:

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

input:

4 3 3
2 1 3 1
2 1
3 2
4 1

output:

3 2 1 2 

result:

ok n=4, m=3, k=3

Test #15:

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

input:

2 1 2
1 2
2 1

output:

2 1 

result:

ok n=2, m=1, k=2

Test #16:

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

input:

10 45 10
1 2 3 4 5 6 7 8 9 10
1 3
1 4
1 5
1 9
2 1
2 4
2 5
2 8
2 9
2 10
3 2
3 7
3 8
3 10
4 3
4 6
4 7
4 10
5 3
5 4
5 8
6 1
6 2
6 3
6 5
6 8
7 1
7 2
7 5
7 6
7 9
7 10
8 1
8 4
8 7
9 3
9 4
9 5
9 6
9 8
10 1
10 5
10 6
10 8
10 9

output:

2 3 4 5 6 7 8 9 10 1 

result:

ok n=10, m=45, k=10

Test #17:

score: 0
Accepted
time: 3ms
memory: 17892kb

input:

1000 499500 1000
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 89 90 91 92 93 94 95 96 97 9...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=1000, m=499500, k=1000

Test #18:

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

input:

239 28441 239
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 89 90 91 92 93 94 95 96 97 98 9...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=239, m=28441, k=239

Test #19:

score: 0
Accepted
time: 3ms
memory: 13816kb

input:

4 6 4
1 2 3 4
1 4
2 1
2 4
3 1
3 2
4 3

output:

2 3 4 1 

result:

ok n=4, m=6, k=4

Test #20:

score: 0
Accepted
time: 10ms
memory: 18072kb

input:

999 498501 999
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 89 90 91 92 93 94 95 96 97 98 ...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=999, m=498501, k=999

Test #21:

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

input:

30 435 30
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
1 3
1 4
1 6
1 7
1 8
1 9
1 10
1 13
1 17
1 20
1 21
1 25
1 26
1 27
2 1
2 4
2 5
2 6
2 8
2 11
2 14
2 15
2 16
2 17
2 18
2 19
2 21
2 23
2 26
2 27
2 29
3 2
3 6
3 7
3 12
3 13
3 15
3 16
3 17
3 20
3 21
3 27
3 29
3 30
4 3...

output:

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 1 

result:

ok n=30, m=435, k=30

Test #22:

score: 0
Accepted
time: 3ms
memory: 13740kb

input:

37 666 37
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
1 3
1 9
1 10
1 11
1 14
1 17
1 18
1 19
1 23
1 25
1 26
1 28
1 29
1 30
1 31
1 34
1 35
1 37
2 1
2 5
2 7
2 8
2 9
2 11
2 12
2 14
2 15
2 18
2 19
2 20
2 21
2 23
2 24
2 25
2 26
2 30
2 33
2 35
2 37
...

output:

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 1 

result:

ok n=37, m=666, k=37

Test #23:

score: 0
Accepted
time: 7ms
memory: 15804kb

input:

500 124750 500
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 89 90 91 92 93 94 95 96 97 98 ...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=500, m=124750, k=500

Test #24:

score: 0
Accepted
time: 12ms
memory: 17852kb

input:

988 487578 988
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 89 90 91 92 93 94 95 96 97 98 ...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=988, m=487578, k=988

Test #25:

score: 0
Accepted
time: 12ms
memory: 18072kb

input:

932 433846 932
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 89 90 91 92 93 94 95 96 97 98 ...

output:

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...

result:

ok n=932, m=433846, k=932

Test #26:

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

input:

1 0 1
1

output:

1 

result:

ok n=1, m=0, k=1

Test #27:

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

input:

2 1 2
1 2
2 1

output:

2 1 

result:

ok n=2, m=1, k=2

Test #28:

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

input:

2 1 2
1 2
2 1

output:

2 1 

result:

ok n=2, m=1, k=2

Test #29:

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

input:

10 9 4
1 2 3 1 3 1 3 2 3 1
2 1
3 2
4 3
5 4
6 5
7 6
8 7
9 8
10 9

output:

2 3 4 3 2 1 4 3 4 3 

result:

ok n=10, m=9, k=4

Test #30:

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

input:

1000 10000 100
87 95 7 96 16 76 19 68 100 93 31 85 63 77 82 42 85 33 98 25 89 25 99 92 24 87 80 86 77 67 3 5 19 90 33 86 89 38 26 14 19 40 28 14 99 31 60 87 19 71 10 14 37 66 68 64 89 4 91 37 28 19 76 72 91 70 31 37 28 42 26 24 38 51 63 6 22 22 44 1 55 40 36 69 82 61 5 91 32 63 60 73 99 31 54 2 66 1...

output:

88 60 62 60 66 87 69 83 61 58 69 58 84 86 57 74 56 72 60 68 56 77 60 57 67 56 54 57 88 84 62 61 66 57 73 59 56 73 69 71 65 74 67 65 63 68 82 55 65 54 64 64 73 54 87 82 59 61 60 72 67 67 87 86 60 85 70 73 73 82 69 67 72 82 87 64 68 67 73 62 78 72 71 86 56 84 61 56 71 82 81 85 63 75 78 63 85 67 60 50 ...

result:

ok n=1000, m=10000, k=100

Test #31:

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

input:

10 15 5
1 3 2 2 3 3 1 1 4 2
2 1
3 1
4 2
4 9
5 1
5 4
5 7
5 9
6 1
6 7
7 3
8 3
8 6
9 6
10 6

output:

2 1 3 5 1 1 2 2 2 5 

result:

ok n=10, m=15, k=5

Test #32:

score: 0
Accepted
time: 38ms
memory: 22240kb

input:

30000 200000 1000
162 342 574 762 997 367 451 858 680 686 720 881 700 749 927 392 402 652 137 152 772 549 639 593 954 152 409 350 325 94 577 222 813 409 279 83 142 577 445 294 878 215 884 801 159 581 468 714 291 755 127 229 922 931 206 578 780 741 617 530 788 514 234 413 130 580 834 437 688 867 89 3...

output:

163 150 162 162 141 151 150 132 161 159 130 140 122 162 140 145 149 157 142 144 134 162 126 127 162 144 154 150 148 137 158 141 130 152 146 149 139 158 152 141 141 149 136 134 144 124 151 122 148 129 141 144 140 150 141 121 132 125 155 155 130 153 147 155 142 125 130 156 161 131 153 152 144 155 147 ...

result:

ok n=30000, m=200000, k=1000

Test #33:

score: 0
Accepted
time: 36ms
memory: 24568kb

input:

23923 239239 239239
218201 175552 191424 205458 207189 210258 173683 109081 22520 167503 135263 100313 116435 226001 14596 10832 101211 197385 144248 140485 196107 176044 197145 162189 51641 49690 205181 144176 22360 112556 95875 14356 44237 116133 126644 146286 41030 220736 234286 123941 201457 151...

output:

218202 218201 218160 218161 218164 218165 218159 218193 218177 218150 218196 218189 218194 218166 218176 218168 218192 218159 218149 218194 218167 218156 218163 218159 218181 218176 218165 218152 218174 218193 218189 218171 218182 218195 218194 218195 218177 218167 218167 218197 218165 218154 218173...

result:

ok n=23923, m=239239, k=239239

Test #34:

score: 0
Accepted
time: 26ms
memory: 22420kb

input:

10000 239000 1000
830 816 588 81 331 726 933 772 964 22 226 696 247 557 199 314 89 400 609 373 678 44 645 768 52 101 704 464 79 922 623 368 973 54 823 535 467 167 693 58 933 898 502 92 881 979 768 972 923 729 14 838 473 735 255 328 719 243 727 406 164 866 178 445 74 297 567 291 792 989 866 84 523 61...

output:

831 830 817 763 787 729 744 726 747 761 776 723 779 810 772 784 762 795 811 794 820 760 820 729 759 764 728 800 758 749 812 786 757 762 737 805 801 773 825 758 746 745 802 758 740 748 826 748 747 825 754 736 803 726 776 787 723 772 724 791 771 738 772 799 762 781 810 780 731 749 738 757 807 815 735 ...

result:

ok n=10000, m=239000, k=1000

Test #35:

score: 0
Accepted
time: 70ms
memory: 31664kb

input:

20000 500000 1000
419 672 848 423 906 141 551 685 125 226 873 586 785 669 914 99 610 843 734 869 854 729 140 254 241 436 704 522 737 9 607 950 875 788 295 920 731 523 91 28 942 779 729 47 579 905 623 87 660 930 160 88 593 971 467 895 685 432 147 522 509 583 111 445 399 533 883 325 784 919 59 656 732...

output:

420 338 361 321 370 401 330 339 394 407 369 329 358 339 375 394 338 364 351 366 364 349 396 415 409 316 344 320 347 387 335 373 364 360 418 372 349 332 389 385 374 358 348 387 329 368 330 392 343 376 397 391 332 377 322 369 341 319 394 323 326 331 391 314 306 322 367 302 359 369 385 344 352 305 394 ...

result:

ok n=20000, m=500000, k=1000

Test #36:

score: 0
Accepted
time: 87ms
memory: 34296kb

input:

100000 500000 33000
9268 12341 19458 7922 16366 4090 22601 17440 25495 20980 22841 4456 12772 19555 12480 7078 27427 441 11155 27391 25695 3933 14143 30783 31007 10612 4833 8341 23303 18666 15933 32789 11645 24228 21960 5715 25308 30560 6089 21958 11067 32266 5051 13065 4942 10544 14020 32626 2690 1...

output:

9269 9260 9248 9259 9242 9232 9241 9239 9247 9242 9251 9258 9259 9241 9239 9255 9250 9255 9234 9241 9249 9232 9244 9242 9243 9242 9231 9232 9231 9241 9240 9254 9235 9249 9250 9233 9242 9250 9260 9251 9241 9254 9255 9239 9236 9237 9238 9249 9232 9239 9259 9229 9239 9240 9238 9241 9231 9242 9256 9244 ...

result:

ok n=100000, m=500000, k=33000

Test #37:

score: 0
Accepted
time: 94ms
memory: 39940kb

input:

500000 500000 500000
211528 388055 34644 166109 384814 413216 108307 120428 430880 36146 461434 354152 400903 328422 357107 124169 420364 153811 72615 437513 92697 194228 26206 328865 118741 274081 247329 112425 388234 73875 332122 132252 187681 256132 452658 344401 166979 32236 106225 301058 450650...

output:

211529 211528 211528 211527 211526 211527 211528 211528 211528 211526 211527 211525 211527 211526 211527 211528 211526 211524 211525 211525 211527 211525 211524 211524 211525 211524 211523 211524 211527 211524 211525 211524 211527 211523 211523 211527 211526 211524 211527 211523 211525 211526 211524...

result:

ok n=500000, m=500000, k=500000

Test #38:

score: 0
Accepted
time: 77ms
memory: 36984kb

input:

500000 499999 123901
32379 104763 83694 71174 84740 51729 77708 29454 53825 32137 102754 1120 95274 11534 107584 16626 16587 108925 81688 117022 117367 116972 9134 22288 92320 20504 13277 18003 58760 31410 23254 96631 16410 84996 20154 67148 119437 60466 25231 16742 13440 36401 21212 63998 62267 765...

output:

32380 32379 32379 32378 32379 32377 32379 32377 32376 32378 32376 32378 32378 32376 32375 32378 32378 32377 32379 32378 32377 32376 32376 32377 32377 32378 32379 32375 32377 32377 32376 32377 32377 32378 32378 32378 32377 32374 32378 32376 32376 32376 32373 32375 32375 32374 32377 32374 32377 32374 ...

result:

ok n=500000, m=499999, k=123901

Test #39:

score: 0
Accepted
time: 68ms
memory: 39752kb

input:

500000 499999 10
8 10 6 1 1 4 9 7 8 1 10 1 2 5 4 2 4 4 3 6 6 2 7 8 7 7 7 10 9 5 6 3 3 10 8 10 5 7 9 7 2 9 9 8 9 10 9 4 4 5 8 9 5 5 2 5 9 4 8 4 6 5 6 1 6 3 7 7 10 9 4 8 4 3 8 5 1 2 2 2 3 3 2 4 1 2 2 4 2 5 8 5 10 4 8 1 5 6 6 8 8 6 8 2 9 6 5 4 6 8 6 8 4 4 10 1 4 1 8 4 8 2 5 1 2 2 7 5 2 7 4 10 2 9 4 3 1...

output:

9 8 7 9 6 6 8 7 7 8 8 5 6 8 6 5 5 5 7 7 6 6 8 5 7 6 4 4 5 8 7 5 7 6 4 7 6 7 5 4 10 7 6 5 6 4 5 4 3 7 5 7 5 5 5 5 6 4 5 6 6 6 6 4 5 5 6 6 6 3 3 5 4 6 7 5 3 6 5 5 6 2 6 4 5 3 5 5 4 5 4 5 5 4 2 3 5 6 4 2 3 5 5 3 5 4 2 4 3 4 3 5 1 3 4 3 2 4 3 4 3 2 2 4 5 3 4 3 2 1 3 3 5 10 2 2 1 3 1 9 9 2 2 4 3 1 2 1 2 ...

result:

ok n=500000, m=499999, k=10

Test #40:

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

input:

1 0 1
1

output:

1 

result:

ok n=1, m=0, k=1

Test #41:

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

input:

10 16 4
1 4 3 2 3 4 3 1 4 2
2 1
3 2
4 1
4 3
5 1
5 4
6 1
6 5
7 2
7 6
8 2
8 7
9 1
9 8
10 2
10 9

output:

2 1 4 3 4 1 4 2 1 4 

result:

ok n=10, m=16, k=4

Test #42:

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

input:

1000 9000 6
3 4 2 5 4 3 1 6 2 6 1 4 5 1 3 2 5 3 4 6 1 4 4 5 5 1 2 2 6 1 3 5 3 6 1 2 2 4 6 2 5 2 3 1 4 4 3 5 5 4 2 3 1 2 4 6 3 2 1 6 5 1 4 4 6 6 4 1 5 5 6 3 2 4 2 1 1 2 4 6 5 5 1 5 1 1 4 3 6 6 4 3 5 4 2 5 6 6 1 6 1 1 4 5 5 4 1 1 6 1 4 3 5 1 5 6 2 4 2 5 6 4 3 6 1 3 1 1 2 5 6 5 1 5 4 1 6 4 5 6 4 3 6 2 ...

output:

4 5 3 6 5 4 2 1 3 1 2 5 6 2 4 3 6 4 5 1 2 5 5 6 6 2 3 3 1 2 4 6 4 1 2 3 3 5 1 3 6 3 4 2 5 5 4 6 6 5 3 4 2 3 5 1 4 3 2 1 6 2 5 5 1 1 5 2 6 6 1 4 3 5 3 2 2 3 5 1 6 6 2 6 2 2 5 4 1 1 5 4 6 5 3 6 1 1 2 1 2 2 5 6 6 5 2 2 1 2 5 4 6 2 6 1 3 5 3 6 2 5 4 1 2 4 2 2 3 6 1 6 2 6 5 2 1 5 6 1 5 4 1 3 3 4 6 2 6 2 ...

result:

ok n=1000, m=9000, k=6

Test #43:

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

input:

10000 320000 15
12 13 4 9 5 1 5 5 6 7 6 10 9 10 6 9 4 9 9 7 14 6 11 11 2 6 14 8 11 11 8 4 13 9 11 4 3 15 15 11 5 11 4 15 12 6 2 7 9 12 12 8 12 3 10 4 12 14 10 12 1 8 6 1 15 8 14 15 6 5 7 2 7 4 15 4 12 2 12 7 2 3 12 3 2 9 4 5 2 14 10 12 4 8 9 10 5 14 6 6 7 7 10 5 6 3 14 15 7 8 1 11 14 11 4 1 2 6 4 15...

output:

13 14 5 10 6 2 6 6 7 8 7 11 10 11 7 10 5 10 10 8 15 7 12 12 3 7 15 9 12 12 9 5 14 10 12 5 4 1 1 12 6 12 5 1 13 7 3 8 10 13 13 9 13 4 11 5 13 15 11 13 2 9 7 2 1 9 15 1 7 6 8 3 8 5 1 5 13 3 13 8 3 4 13 4 3 10 5 6 3 15 11 13 5 9 10 11 6 15 7 7 8 8 11 6 7 4 15 1 8 9 2 12 15 12 5 2 3 7 5 1 10 13 14 1 2 4...

result:

ok n=10000, m=320000, k=15

Test #44:

score: 0
Accepted
time: 71ms
memory: 35100kb

input:

100000 500000 98
77 62 32 77 73 14 30 8 35 27 26 30 71 93 98 11 53 39 69 98 31 67 19 13 9 62 41 27 78 81 79 33 57 61 81 97 29 23 63 77 71 98 51 68 74 64 68 46 48 90 18 58 91 1 69 76 45 92 4 41 97 65 54 51 38 85 76 37 98 51 52 57 60 33 23 38 37 69 55 13 6 28 32 48 56 19 81 1 70 56 77 56 3 26 6 91 6 5...

output:

78 69 57 33 76 47 56 44 60 54 52 56 74 39 41 45 65 61 74 40 58 72 48 46 44 69 62 55 34 35 34 58 68 69 35 40 56 51 70 33 33 47 71 33 53 43 32 72 72 41 54 71 43 45 34 36 67 39 49 68 51 50 67 70 66 49 43 66 65 73 32 72 38 65 57 67 32 41 72 60 61 70 65 69 36 56 52 42 73 45 37 73 57 55 43 49 52 33 51 49 ...

result:

ok n=100000, m=500000, k=98

Test #45:

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

input:

400 797 3
3 1 2 2 1 2 1 1 2 3 3 2 2 3 1 3 1 3 2 3 1 1 3 2 3 1 3 1 1 2 3 3 1 2 3 1 2 3 3 1 1 2 1 1 3 2 2 2 3 2 3 2 1 2 1 1 3 2 2 3 3 2 3 1 2 1 3 3 1 2 1 2 2 3 2 3 1 3 1 3 2 2 1 3 2 3 1 2 3 3 2 1 1 3 1 3 3 1 1 2 3 1 3 3 2 3 3 1 1 3 3 1 1 2 2 3 3 3 1 2 2 2 1 3 2 1 3 1 2 3 2 1 3 3 3 1 1 1 2 3 3 1 3 1 3 ...

output:

1 2 3 3 2 3 2 2 3 1 1 3 3 1 2 1 2 1 3 1 2 2 1 3 1 2 1 2 2 3 1 1 2 3 1 2 3 1 1 2 2 3 2 2 1 3 3 3 1 3 1 3 2 3 2 2 1 3 3 2 1 3 1 2 3 2 1 1 2 3 2 3 3 1 3 1 2 1 2 1 3 3 2 1 3 2 2 3 1 1 3 2 2 1 2 1 1 2 2 3 1 2 1 1 3 1 1 2 2 1 1 2 2 3 3 1 1 2 2 3 3 3 2 1 3 2 1 2 3 1 3 2 1 1 1 2 2 2 3 1 1 2 1 2 1 3 1 3 1 3 ...

result:

ok n=400, m=797, k=3

Test #46:

score: 0
Accepted
time: 98ms
memory: 30060kb

input:

100000 500000 123
113 5 99 17 73 68 79 118 51 112 17 89 44 29 112 35 120 43 28 34 84 71 74 10 5 67 33 42 29 120 107 67 94 63 82 77 85 18 18 122 87 100 102 70 97 31 32 82 26 101 71 16 112 28 60 108 55 93 23 44 93 81 11 42 43 5 5 1 99 101 6 76 115 115 121 10 82 47 120 59 73 40 81 62 66 69 81 81 90 57 ...

output:

114 83 111 86 104 101 105 80 97 79 86 108 94 90 79 93 81 93 91 91 106 106 103 86 84 101 92 95 89 80 78 103 111 101 105 105 109 86 88 84 108 110 76 104 112 90 92 106 90 76 102 87 77 90 101 78 101 109 87 95 110 105 83 94 95 85 86 83 111 76 84 105 81 81 81 84 106 95 82 98 105 94 106 102 102 102 106 105...

result:

ok n=100000, m=500000, k=123

Test #47:

score: 0
Accepted
time: 35ms
memory: 20644kb

input:

100000 500000 7
3 4 2 6 5 7 2 4 3 4 1 6 2 2 4 3 2 6 1 4 1 3 5 6 1 4 1 2 6 6 1 4 4 2 4 4 3 1 7 2 7 1 6 4 6 5 3 7 3 1 5 4 5 2 4 1 1 5 2 6 1 6 4 2 2 2 5 4 3 6 1 2 5 1 2 5 1 2 5 5 6 6 1 4 1 2 5 5 7 5 1 7 3 4 2 2 7 6 1 7 3 2 2 1 5 1 4 1 4 5 2 6 3 6 2 5 4 5 2 3 1 7 4 1 5 4 7 1 2 4 5 2 5 3 5 2 1 7 3 5 3 4 ...

output:

4 5 3 7 6 1 5 5 4 5 2 2 3 3 5 4 3 7 2 5 2 4 6 7 3 5 2 3 7 7 2 5 5 3 5 5 4 2 2 3 1 3 7 5 7 6 5 3 4 2 6 5 6 3 5 2 2 6 3 7 2 7 5 3 3 3 6 5 4 7 2 3 6 2 3 6 2 3 6 6 7 7 2 6 2 3 6 6 1 6 2 2 4 5 3 3 1 7 2 1 4 3 3 2 6 2 5 2 5 6 3 7 4 7 3 6 5 6 3 4 2 1 5 2 6 5 2 2 4 5 6 3 6 4 6 3 2 3 4 6 4 5 5 3 6 4 5 5 7 6 ...

result:

ok n=100000, m=500000, k=7

Test #48:

score: 0
Accepted
time: 33ms
memory: 24148kb

input:

23923 232932 98
4 19 50 43 11 17 12 30 41 87 49 25 63 38 90 59 90 98 49 79 63 89 35 89 40 72 32 95 85 39 63 8 32 45 27 28 22 20 54 68 40 83 93 32 69 13 36 66 75 43 76 86 88 30 94 80 79 14 32 15 83 94 62 80 22 20 65 52 5 6 12 19 42 85 59 6 70 64 46 37 31 38 6 92 73 39 40 72 55 52 97 56 51 1 73 14 47 ...

output:

5 58 77 74 55 60 54 65 72 96 77 63 85 70 98 83 1 50 76 92 87 1 69 2 72 91 66 4 96 71 86 54 67 76 65 65 62 59 80 88 76 95 49 66 89 62 72 92 1 81 92 1 98 68 49 97 1 56 70 64 50 61 90 93 64 64 89 84 55 58 61 64 73 49 86 57 89 90 85 73 67 71 52 55 94 73 75 93 88 84 58 92 82 53 95 62 78 94 88 89 73 95 57...

result:

ok n=23923, m=232932, k=98

Test #49:

score: 0
Accepted
time: 70ms
memory: 28824kb

input:

76598 387654 181
179 114 15 139 123 143 162 169 143 23 141 2 70 115 173 69 136 30 156 72 181 8 126 4 7 90 46 74 154 132 92 162 2 82 99 36 21 162 100 36 163 133 79 88 79 70 108 146 67 73 170 30 7 73 70 6 169 135 160 153 72 46 49 10 133 106 147 74 157 74 107 14 137 160 32 9 109 174 88 4 135 20 105 110...

output:

180 158 140 167 162 169 174 177 169 143 168 136 150 168 141 161 173 161 142 156 135 139 167 142 143 134 165 165 177 178 164 138 141 159 173 147 154 140 165 153 178 134 154 165 172 155 166 172 155 157 149 155 142 153 157 154 140 166 177 141 161 147 147 146 165 161 141 168 147 164 170 148 166 134 165 ...

result:

ok n=76598, m=387654, k=181

Test #50:

score: 0
Accepted
time: 55ms
memory: 32912kb

input:

49999 500000 74
22 7 27 40 31 35 50 20 21 67 52 60 48 28 26 33 34 27 21 9 3 40 47 12 24 33 7 57 11 38 12 67 47 68 29 69 53 70 54 53 8 74 42 45 11 63 44 10 46 38 50 22 40 42 49 54 74 69 74 25 34 43 40 30 54 59 6 4 45 32 18 57 25 63 56 21 16 37 57 6 51 23 63 36 34 69 5 49 46 68 57 42 2 38 51 26 64 19 ...

output:

23 12 49 59 53 55 65 21 22 4 68 73 64 49 48 53 55 50 23 13 10 58 64 16 48 54 12 70 15 57 16 4 64 5 51 6 68 6 69 68 13 8 60 62 15 2 61 16 63 57 67 23 58 61 66 69 9 5 8 49 54 60 58 52 69 73 13 44 64 59 20 72 54 5 72 51 46 57 3 12 71 53 9 57 56 8 12 66 67 5 74 63 19 60 68 55 8 52 48 15 63 73 18 50 67 6...

result:

ok n=49999, m=500000, k=74

Test #51:

score: 0
Accepted
time: 3ms
memory: 13792kb

input:

10 40 244
1 1 2 2 3 3 4 4 5 5
1 3
1 4
1 6
1 7
1 10
2 4
2 6
2 9
2 10
3 2
3 6
3 9
4 5
4 6
4 7
4 8
4 10
5 1
5 2
5 3
5 9
6 9
6 10
7 2
7 3
7 5
7 6
7 9
8 1
8 2
8 3
8 5
8 6
8 9
9 1
9 4
10 3
10 5
10 7
10 8

output:

2 2 3 3 4 4 5 5 6 6 

result:

ok n=10, m=40, k=244

Test #52:

score: 0
Accepted
time: 7ms
memory: 13796kb

input:

478 113068 478
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 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 ...

output:

2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 10 10 11 11 12 12 13 13 14 14 15 15 16 16 17 17 18 18 19 19 20 20 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 29 30 30 31 31 32 32 33 33 34 34 35 35 36 36 37 37 38 38 39 39 40 40 41 41 42 42 43 43 44 44 45 45 46 46 47 47 48 48 49 49 50 50 51 51 52 52 53 53 54 5...

result:

ok n=478, m=113068, k=478

Test #53:

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

input:

478 102491 286
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4...

output:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 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 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 ...

result:

ok n=478, m=102491, k=286

Test #54:

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

input:

726 248007 278
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 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 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...

output:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 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 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 ...

result:

ok n=726, m=248007, k=278

Test #55:

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

input:

5 8 241
1 1 2 2 3
1 3
2 4
3 2
4 1
5 1
5 2
5 3
5 4

output:

2 2 3 3 4 

result:

ok n=5, m=8, k=241

Test #56:

score: 0
Accepted
time: 14ms
memory: 15868kb

input:

1002 493664 339
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13...

output:

2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14...

result:

ok n=1002, m=493664, k=339

Test #57:

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

input:

1100 97927 1239
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok n=1100, m=97927, k=1239

Test #58:

score: 0
Accepted
time: 15ms
memory: 17852kb

input:

999 490723 338
1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 ...

output:

2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 11 11 11 11 11 11 11 11 11 11 12 12 12 12 12 12 12 12 12 12 13 13 13 13 13 13 13 13 13 13 14 14 14 14 14 14 14...

result:

ok n=999, m=490723, k=338

Test #59:

score: 0
Accepted
time: 11ms
memory: 17796kb

input:

1100 497829 439
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok n=1100, m=497829, k=439

Test #60:

score: 0
Accepted
time: 14ms
memory: 15992kb

input:

1040 498901 315
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

output:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 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 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 3 3 3 3 3 3 3 3 ...

result:

ok n=1040, m=498901, k=315

Test #61:

score: 0
Accepted
time: 16ms
memory: 15740kb

input:

912 311122 478
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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:

2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ...

result:

ok n=912, m=311122, k=478

Test #62:

score: 0
Accepted
time: 16ms
memory: 17856kb

input:

1000 487196 291
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 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 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 ...

output:

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 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 5 5 5 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 9 ...

result:

ok n=1000, m=487196, k=291