QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#118472 | #4303. New Level | chenshi | TL | 237ms | 67680kb | C++ | 1.5kb | 2023-07-03 16:28:58 | 2023-07-03 16:28:59 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int o=5e5+10;
int n,m,K,h[o],cnt,c[o];bool vis[o];double w[o];set<int> ban[o];mt19937 rnd(time(0));
struct Edge{int v,p;}e[o*2];
inline void ad(int U,int V){e[++cnt].v=V;e[cnt].p=h[U];h[U]=cnt;}
void dfs(int nw){
if(vis[nw]) return;
vis[nw]=1;
for(int i=h[nw];i;i=e[i].p) if(c[e[i].v]==(c[nw]+1)%K||c[nw]==(c[e[i].v]+1)%K) dfs(e[i].v);
}
inline bool chk(){
for(int i=1;i<=n;++i) if(!vis[i]) return false;
return true;
}
struct info{
int u,c;double w;
inline bool operator<(const info&b)const{return w<b.w;}
};
priority_queue<info> q;
int main(){
scanf("%d%d%d",&n,&m,&K);
for(int i=1;i<=n;++i) scanf("%d",&c[i]),--c[i];
for(int u,v;m--;) scanf("%d%d",&u,&v),ad(u,v),ad(v,u);
dfs(1);
for(;!chk();){
for(int i=1;i<=n;++i) vis[i]=0,set<int>().swap(ban[i]),w[i]=1;
q.push((info){(int)(rnd()%n+1),0,0.0});
for(int u,col,d;!q.empty();){
u=q.top().u;col=q.top().c;q.pop();
if(vis[u]) continue;
d=((rnd()&1)?K-1:1);
if(ban[u].find((col+d)%K)==ban[u].end()){
c[u]=(col+d)%K;vis[u]=1;
for(int i=h[u];i;i=e[i].p) if(!vis[e[i].v])
ban[e[i].v].insert(c[u]),q.push((info){e[i].v,c[u],w[e[i].v]*(double)ban[e[i].v].size()});
}
else if(ban[u].find((col+K-d)%K)==ban[u].end()){
c[u]=(col+K-d)%K;vis[u]=1;
for(int i=h[u];i;i=e[i].p) if(!vis[e[i].v])
ban[e[i].v].insert(c[u]),q.push((info){e[i].v,c[u],w[e[i].v]*(double)ban[e[i].v].size()});
}
}
}
for(int i=1;i<=n;++i) printf("%d ",c[i]+1);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 4ms
memory: 32508kb
input:
4 4 4 1 2 3 1 1 2 1 3 2 3 3 4
output:
4 1 2 3
result:
ok n=4, m=4, k=4
Test #2:
score: 0
Accepted
time: 7ms
memory: 30348kb
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:
3 2 3 3 1 2 3 1 1 2
result:
ok n=10, m=9, k=3
Test #3:
score: 0
Accepted
time: 8ms
memory: 32384kb
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:
3 4 3 4 2 2 2 1 3 3 2 2 4 2 1 1 3 2 4 5 1 4 2 2 3 4 1 2 2 2 1 1 3 1 10 10 4 1 9 9 5 10 6 10 9 7 1 8 8 7 8 6 6 5 6 9 6 7 7 8 5 7 7 9 10 6 8 7 9 10 8 8 9 1 2 3 3 4 3 1 4 2 4 5 1 5 3 4 4 4 2 1 5 3 3 3 2 2 1 2 3 3 2 4 4 2 5 3 1 4 10 6 5 1 10 7 4 1 1 6 2 2 1 2 10 10 2 3 1 10 4 1 2 1 9 10 2 10 1 8 10 9 7 ...
result:
ok n=239, m=238, k=10
Test #4:
score: 0
Accepted
time: 1ms
memory: 30428kb
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:
7 8 9 7 8 9 10 11 10 7 8 7 10 8 9 12 9 10 9 12 8 9 6 8 5 8 8 8 9 8 4 9 9 4 9 10 10 8 8 9 9 9 7 6 6 7 8 8 8 7 10 8 8 5 5 6 8 6 5 10 9 9 9 8 8 9 9 10 10 10 9 8 9 8 9 11 9 5 8 10 7 8 8 11 6 10 10 7 5 7 11 8 10 9 7 13 7 8 6 8 13 5 7 5 10 4 9 7 8 11 10 11 7 8 7 7 11 8 12 10 8 4 6 11 4 9 8 11 10 7 9 10 9 ...
result:
ok n=2392, m=2391, k=100
Test #5:
score: 0
Accepted
time: 1ms
memory: 30272kb
input:
4 3 3 1 3 1 2 2 1 3 2 4 2
output:
1 3 1 2
result:
ok n=4, m=3, k=3
Test #6:
score: 0
Accepted
time: 0ms
memory: 32732kb
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:
212 213 211 212 213 212 214 210 214 209 215 213 210 210 211 209 208 210 207 208 207 207 211 213 209 215 208 215 1 1 211 206 214 2 210 210 210 211 214 211 215 1 215 213 209 210 207 212 1 210 209 213 214 2 211 212 213 208 211 208 209 212 3 214 207 208 211 209 210 212 211 215 211 208 211 212 210 1 209 ...
result:
ok n=5000, m=4999, k=215
Test #7:
score: 0
Accepted
time: 7ms
memory: 32592kb
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:
20 21 22 21 20 21 22 21 22 21 22 21 22 23 22 21 20 19 20 21 20 19 18 19 18 19 18 17 18 17 16 15 14 13 14 15 14 15 16 15 14 13 14 15 16 17 18 19 20 19 20 21 22 21 22 23 22 21 20 19 20 19 18 17 16 15 14 15 16 15 16 17 18 19 20 21 22 21 20 19 18 19 18 19 20 19 20 19 18 17 18 17 16 15 14 15 14 15 14 15 ...
result:
ok n=5000, m=4999, k=215
Test #8:
score: 0
Accepted
time: 31ms
memory: 42252kb
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:
9 8 7 7 6 8 9 8 6 7 9 7 7 7 6 9 8 10 5 5 6 7 4 8 7 9 8 5 6 9 3 2 5 6 7 8 9 6 1 6 8 6 5 8 9 10 7 6 6 6 6 4 7 8 10 6 1 9 7 7 9 9 3 7 8 4 9 5 10 8 8 7 7 8 7 6 8 7 5 4 8 3 6 3 4 6 4 6 6 6 5 7 11 5 11 4 10 9 10 10 7 7 5 10 10 5 9 4 7 3 8 10 8 5 7 11 7 5 4 4 6 11 6 4 8 9 4 4 7 7 8 3 6 5 9 10 8 8 10 2 4 7 ...
result:
ok n=100000, m=99999, k=215
Test #9:
score: 0
Accepted
time: 26ms
memory: 39016kb
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:
121 120 119 118 117 118 117 118 119 118 117 118 119 120 121 122 123 122 121 120 121 120 119 120 119 120 121 122 123 124 123 122 123 122 121 122 121 120 119 118 119 120 119 120 119 118 119 118 119 118 119 118 117 116 117 118 117 118 117 116 117 116 117 118 119 118 117 118 117 116 115 116 117 118 117 ...
result:
ok n=100000, m=99999, k=215
Test #10:
score: 0
Accepted
time: 86ms
memory: 50624kb
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:
232 231 231 232 231 232 233 232 230 233 230 232 229 229 231 229 228 227 232 230 232 232 232 230 226 229 233 231 232 228 230 231 230 232 231 233 232 231 230 232 233 225 231 231 229 229 228 232 230 232 233 231 229 232 231 232 233 230 230 232 233 234 234 233 234 230 232 229 233 232 233 229 232 229 229 ...
result:
ok n=239239, m=239238, k=239
Test #11:
score: 0
Accepted
time: 28ms
memory: 35236kb
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:
453 454 454 453 454 455 453 455 454 452 453 456 453 454 453 454 453 454 453 454 453 453 452 452 453 455 453 454 456 453 452 454 452 1 453 453 452 454 454 454 455 454 455 455 453 455 455 452 455 454 452 1 454 452 452 454 455 456 454 455 452 454 455 455 455 453 454 455 454 1 453 455 455 453 453 453 45...
result:
ok n=73223, m=73222, k=456
Test #12:
score: 0
Accepted
time: 157ms
memory: 66820kb
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:
28 29 30 27 29 28 29 30 27 27 28 29 28 28 31 26 26 30 27 30 28 29 27 29 27 28 30 31 30 29 31 28 29 29 26 28 28 30 28 32 27 29 26 27 29 26 29 29 26 28 26 27 28 26 27 26 27 29 28 29 30 29 25 28 30 29 32 30 28 28 30 25 29 31 27 30 29 30 28 26 29 28 26 29 27 30 29 29 31 29 30 30 27 29 29 30 26 30 26 27 ...
result:
ok n=500000, m=499999, k=120
Test #13:
score: 0
Accepted
time: 3ms
memory: 30276kb
input:
3 2 2 1 2 2 2 1 3 1
output:
1 2 2
result:
ok n=3, m=2, k=2
Test #14:
score: 0
Accepted
time: 6ms
memory: 32304kb
input:
4 3 3 2 1 3 1 2 1 3 2 4 1
output:
2 1 3 1
result:
ok n=4, m=3, k=3
Test #15:
score: 0
Accepted
time: 6ms
memory: 32308kb
input:
2 1 2 1 2 2 1
output:
1 2
result:
ok n=2, m=1, k=2
Test #16:
score: 0
Accepted
time: 6ms
memory: 30264kb
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:
1 2 3 4 5 6 7 8 9 10
result:
ok n=10, m=45, k=10
Test #17:
score: 0
Accepted
time: 51ms
memory: 38792kb
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:
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 99 100 101 102 ...
result:
ok n=1000, m=499500, k=1000
Test #18:
score: 0
Accepted
time: 4ms
memory: 32776kb
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:
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 99 100 101 102 ...
result:
ok n=239, m=28441, k=239
Test #19:
score: 0
Accepted
time: 1ms
memory: 30272kb
input:
4 6 4 1 2 3 4 1 4 2 1 2 4 3 1 3 2 4 3
output:
1 2 3 4
result:
ok n=4, m=6, k=4
Test #20:
score: 0
Accepted
time: 41ms
memory: 37780kb
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:
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 99 100 101 102 ...
result:
ok n=999, m=498501, k=999
Test #21:
score: 0
Accepted
time: 4ms
memory: 30460kb
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:
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
result:
ok n=30, m=435, k=30
Test #22:
score: 0
Accepted
time: 1ms
memory: 30280kb
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:
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
result:
ok n=37, m=666, k=37
Test #23:
score: 0
Accepted
time: 12ms
memory: 33676kb
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:
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 99 100 101 102 ...
result:
ok n=500, m=124750, k=500
Test #24:
score: 0
Accepted
time: 49ms
memory: 37560kb
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:
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 99 100 101 102 ...
result:
ok n=988, m=487578, k=988
Test #25:
score: 0
Accepted
time: 37ms
memory: 38476kb
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:
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 99 100 101 102 ...
result:
ok n=932, m=433846, k=932
Test #26:
score: 0
Accepted
time: 1ms
memory: 32304kb
input:
1 0 1 1
output:
1
result:
ok n=1, m=0, k=1
Test #27:
score: 0
Accepted
time: 0ms
memory: 30320kb
input:
2 1 2 1 2 2 1
output:
1 2
result:
ok n=2, m=1, k=2
Test #28:
score: 0
Accepted
time: 1ms
memory: 32540kb
input:
2 1 2 1 2 2 1
output:
1 2
result:
ok n=2, m=1, k=2
Test #29:
score: 0
Accepted
time: 1ms
memory: 32328kb
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:
3 2 1 2 1 2 1 2 1 4
result:
ok n=10, m=9, k=4
Test #30:
score: 0
Accepted
time: 2ms
memory: 30768kb
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:
82 88 83 83 92 86 85 91 99 79 96 83 95 100 2 100 83 82 88 97 77 97 90 80 88 81 78 84 76 81 82 97 90 99 84 92 3 3 1 8 95 93 95 83 94 96 87 89 98 92 2 85 91 87 95 97 80 10 11 13 83 85 87 91 79 11 95 77 100 96 96 3 4 96 96 2 91 15 83 14 91 88 99 75 79 92 80 86 3 97 97 92 93 86 96 8 88 84 6 92 96 97 97 ...
result:
ok n=1000, m=10000, k=100
Test #31:
score: 0
Accepted
time: 1ms
memory: 30352kb
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:
3 2 4 4 2 2 3 1 3 1
result:
ok n=10, m=15, k=5
Test #32:
score: 0
Accepted
time: 59ms
memory: 48852kb
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:
966 968 950 998 8 993 37 23 997 5 966 4 997 950 974 5 29 16 942 949 945 980 952 978 965 991 945 3 2 946 969 13 19 967 3 961 19 36 943 1 21 978 35 995 18 4 38 18 966 986 5 973 938 951 34 985 985 27 945 942 966 968 990 13 977 989 16 970 964 992 946 950 996 19 25 997 4 17 944 944 2 29 979 952 979 947 9...
result:
ok n=30000, m=200000, k=1000
Test #33:
score: 0
Accepted
time: 83ms
memory: 50104kb
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:
239096 239103 239142 239205 239230 239149 239207 239151 239213 239164 239107 239107 239237 239088 239111 239154 239208 9 239092 239087 239084 239209 239128 239131 239221 239086 239110 239158 239162 239099 239205 239129 239095 239093 239149 239102 239197 239105 239190 239160 239087 239086 239155 2391...
result:
ok n=23923, m=239239, k=239239
Test #34:
score: 0
Accepted
time: 88ms
memory: 48372kb
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:
81 962 54 967 990 61 38 4 997 973 975 43 69 969 67 28 996 27 989 41 977 965 964 989 7 960 950 69 57 997 998 983 56 73 72 968 950 76 44 967 976 966 14 7 8 72 12 37 969 56 980 43 5 28 27 991 66 989 77 70 43 38 6 35 31 49 956 995 965 978 30 991 996 982 989 5 71 2 38 61 39 974 37 982 5 998 30 966 992 39...
result:
ok n=10000, m=239000, k=1000
Test #35:
score: 0
Accepted
time: 213ms
memory: 64800kb
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:
964 952 928 938 977 954 958 968 904 929 935 906 983 984 915 983 995 909 942 933 901 937 964 927 922 946 955 968 921 917 962 933 920 964 914 980 931 956 907 923 905 965 897 923 979 911 1000 981 959 919 904 916 956 977 979 961 959 899 937 938 920 953 910 923 984 940 898 945 999 931 906 937 954 929 982...
result:
ok n=20000, m=500000, k=1000
Test #36:
score: 0
Accepted
time: 237ms
memory: 67680kb
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:
32963 14 6 32972 32973 1 15 33000 1 32998 32949 47 32982 32999 5 32962 32991 32966 24 30 11 38 42 29 32944 32945 12 32994 32944 32995 8 32971 32974 32945 32975 32973 16 32949 32999 32998 32946 32999 32961 32960 33000 32999 33000 6 32968 32999 31 32947 32948 33000 32999 10 32938 32981 32958 32974 29 ...
result:
ok n=100000, m=500000, k=33000
Test #37:
score: 0
Accepted
time: 162ms
memory: 66884kb
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:
39 40 38 39 38 39 38 38 38 40 37 39 39 36 39 40 38 40 39 39 37 41 38 40 35 40 39 42 39 40 39 34 39 43 41 39 38 38 39 37 39 38 38 40 39 41 39 39 42 39 36 38 40 37 35 41 36 43 34 35 34 35 40 38 40 36 38 38 37 37 41 44 39 38 39 38 37 39 37 37 39 37 40 41 39 43 39 41 39 36 36 41 40 35 39 34 42 39 37 41 ...
result:
ok n=500000, m=500000, k=500000
Test #38:
score: 0
Accepted
time: 151ms
memory: 66616kb
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:
123778 123777 123777 123778 123779 123777 123777 123777 123776 123778 123778 123778 123776 123776 123775 123778 123778 123777 123777 123778 123775 123776 123776 123779 123779 123780 123777 123777 123779 123777 123780 123781 123779 123778 123776 123776 123779 123778 123776 123778 123778 123776 123777...
result:
ok n=500000, m=499999, k=123901
Test #39:
score: 0
Accepted
time: 138ms
memory: 66716kb
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 10 9 1 8 10 2 1 9 8 8 9 8 10 8 9 7 7 9 3 10 10 8 7 9 10 8 6 9 8 1 9 9 8 8 9 8 1 1 8 10 7 2 7 8 8 1 10 9 7 9 7 9 9 1 1 8 8 7 2 8 10 8 10 7 9 8 6 10 1 1 9 8 8 9 1 9 8 9 9 10 10 10 8 9 7 7 9 10 9 2 9 1 6 10 5 7 10 10 6 1 7 9 1 9 10 2 10 1 2 5 9 3 1 8 3 10 10 1 10 9 10 2 8 7 5 8 1 2 3 1 7 9 2 10 10 1 ...
result:
ok n=500000, m=499999, k=10
Test #40:
score: 0
Accepted
time: 1ms
memory: 30260kb
input:
1 0 1 1
output:
1
result:
ok n=1, m=0, k=1
Test #41:
score: 0
Accepted
time: 3ms
memory: 32544kb
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:
3 1 4 1 2 4 3 4 1 4
result:
ok n=10, m=16, k=4
Test #42:
score: -100
Time Limit Exceeded
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 ...