QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#118553 | #4303. New Level | lyx123886a123886 | TL | 106ms | 34864kb | C++14 | 2.0kb | 2023-07-03 17:13:22 | 2023-07-03 17:13:24 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int read() {
char ch=getchar();int res=0,fl=1;
while(ch<'0'||ch>'9'){if(ch=='-') fl=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){res=res*10+ch-'0';ch=getchar();}
return res*fl;
}
#define ll long long
struct node{
int u;
ll dis;
};
bool operator <(node A,node B) {return A.dis>B.dis;}
priority_queue<node> q;
const int N=500050;
#define inf 1000000000000
ll dis[N];int vis[N];
int nex[N<<1],fir[N],v[N<<1],w[N<<1],__cnt=0,c[N],n,mod,m;
void addedge(int x,int y,int z) {
nex[++__cnt]=fir[x];
fir[x]=__cnt;
v[__cnt]=y;
w[__cnt]=z;
// printf("(%d,%d,%d)\n",x,y,z);
return ;
}
void dijkstra(int S) {
for(int i=1;i<=n;++i) dis[i]=inf;
dis[S]=0;
// vis[S]=1;!!
q.push((node){S,dis[S]});
while(!q.empty()) {
int u=q.top().u;
q.pop();
if(vis[u]) continue;
vis[u]=1;
// printf("%d",u);
for(int i=fir[u];i;i=nex[i]) {
int to=v[i];
// printf("%d",to);
if(dis[to]>dis[u]+w[i]) {
dis[to]=dis[u]+w[i];
q.push((node){to,dis[to]});//to!!
}
}
}
return ;
}
int fa[N];
int get_fa(int x) {return (fa[x]==x)?x:get_fa(fa[x]);}
int merge(int x,int y) {
x=get_fa(x);y=get_fa(y);
if(x==y) return 0;
fa[x]=y;
return 1;
}
struct edge{
int u,v;
}e[N];
int tot=0;
int d(int x,int y){return (c[y]-c[x]-1+mod)%mod;}//x->y
int main()
{
// freopen("past.in","r",stdin);
// freopen("past.out","w",stdout);
n=read();m=read();mod=read();
for(int i=1;i<=n;++i) c[i]=read()-1;
for(int i=1;i<=n;++i) fa[i]=i;//!
for(int i=1;i<=m;++i) {
e[i].u=read();
e[i].v=read();
if(!d(e[i].u,e[i].v)||!d(e[i].v,e[i].u)) merge(e[i].u,e[i].v);
}
for(int i=1;i<=m;++i) {
int fx=get_fa(e[i].u),fy=get_fa(e[i].v);
if(fx==fy) continue;
addedge(fx,fy,d(e[i].u,e[i].v));
addedge(fy,fx,d(e[i].v,e[i].u));
}
dijkstra(get_fa(1));
// for(int i=1;i<=n;++i) printf("%d,%lld ",get_fa(i),dis[get_fa(i)]);
// printf("\n");
for(int i=1;i<=n;++i) printf("%lld ",((c[i]+inf-dis[get_fa(i)])%mod+mod)%mod+1);
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 3ms
memory: 13772kb
input:
4 4 4 1 2 3 1 1 2 1 3 2 3 3 4
output:
1 2 3 4
result:
ok n=4, m=4, k=4
Test #2:
score: 0
Accepted
time: 2ms
memory: 9664kb
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 1 1 2 3 1 2 2 3
result:
ok n=10, m=9, k=3
Test #3:
score: 0
Accepted
time: 1ms
memory: 13988kb
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:
6 7 8 7 9 7 9 10 8 10 9 9 1 1 10 10 10 1 1 2 2 9 3 3 4 5 4 5 5 5 6 6 4 6 7 7 5 8 8 8 6 9 7 9 10 8 10 1 9 10 9 1 9 2 3 10 3 10 4 5 4 4 6 6 5 5 7 8 4 5 7 9 8 6 7 8 8 9 10 8 9 1 1 2 2 10 2 1 3 3 3 4 4 2 4 4 3 5 6 7 6 6 7 7 7 7 6 8 8 9 7 7 8 8 9 8 9 10 10 9 1 1 2 1 3 3 3 4 4 5 5 2 5 6 6 5 5 7 8 7 9 8 8 ...
result:
ok n=239, m=238, k=10
Test #4:
score: 0
Accepted
time: 2ms
memory: 13884kb
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:
89 90 91 91 92 91 92 93 92 91 92 93 94 92 95 94 91 94 93 94 90 93 90 94 91 94 92 94 91 94 92 95 93 92 91 94 94 96 96 95 93 95 95 92 94 97 94 92 92 95 92 94 90 93 93 92 96 94 93 96 97 95 95 94 96 95 97 94 92 94 95 96 93 98 95 93 97 93 96 98 93 98 96 93 94 98 94 93 91 93 93 90 96 95 97 95 91 90 92 92 ...
result:
ok n=2392, m=2391, k=100
Test #5:
score: 0
Accepted
time: 2ms
memory: 9720kb
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: 16204kb
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:
10 11 11 12 13 12 14 12 14 13 15 11 12 12 11 13 14 12 15 16 17 15 13 13 15 15 14 15 16 16 13 18 12 17 12 14 14 15 14 11 13 14 17 11 17 14 19 12 14 12 13 13 12 17 11 12 13 14 13 18 15 14 18 14 15 20 13 13 14 14 15 17 13 18 13 14 14 18 15 15 15 18 14 18 13 13 21 20 15 15 16 15 15 15 16 19 13 16 15 15 ...
result:
ok n=5000, m=4999, k=215
Test #7:
score: 0
Accepted
time: 1ms
memory: 13956kb
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:
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 16...
result:
ok n=5000, m=4999, k=215
Test #8:
score: 0
Accepted
time: 11ms
memory: 21664kb
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:
79 80 81 81 82 80 81 80 82 83 81 83 83 81 84 81 82 80 83 83 84 81 84 82 83 83 84 83 82 81 85 86 83 84 85 82 81 84 87 82 82 82 83 82 83 82 81 84 82 84 84 86 85 82 82 84 87 83 85 85 83 81 87 83 84 84 83 85 80 82 82 85 81 84 83 84 82 85 85 84 84 85 86 85 84 84 84 84 82 84 85 83 81 85 83 84 82 85 86 84 ...
result:
ok n=100000, m=99999, k=215
Test #9:
score: 0
Accepted
time: 9ms
memory: 17968kb
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:
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 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...
result:
ok n=100000, m=99999, k=215
Test #10:
score: 0
Accepted
time: 47ms
memory: 26284kb
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:
5 6 6 7 8 7 6 7 7 8 7 7 8 8 8 8 9 10 7 9 9 9 7 9 11 10 8 8 9 9 11 8 9 7 8 8 9 10 11 7 6 12 10 12 8 10 9 9 9 9 10 6 10 9 8 11 8 9 11 7 8 9 7 8 9 9 7 10 10 11 8 10 11 10 10 11 12 10 7 9 8 9 13 8 10 9 14 10 12 11 9 9 10 10 11 9 7 11 10 8 10 11 7 8 10 8 9 12 12 11 12 8 10 13 9 9 7 6 11 8 9 8 11 14 10 10...
result:
ok n=239239, m=239238, k=239
Test #11:
score: 0
Accepted
time: 10ms
memory: 17476kb
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:
240 241 241 242 243 244 242 242 241 241 244 245 242 241 242 245 242 243 246 245 244 242 245 245 242 242 242 243 245 242 243 247 245 246 246 242 245 243 243 245 244 243 246 242 246 242 244 243 244 247 243 246 241 247 243 243 244 245 243 244 247 245 244 244 246 248 243 242 247 246 244 248 246 246 244 ...
result:
ok n=73223, m=73222, k=456
Test #12:
score: 0
Accepted
time: 83ms
memory: 30852kb
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:
40 41 42 41 41 42 43 44 43 43 42 43 44 44 43 42 42 42 45 44 44 45 43 43 43 42 46 47 42 43 45 44 43 41 44 44 44 44 46 48 45 43 44 45 45 46 47 43 42 42 44 45 44 46 43 42 45 45 46 45 46 43 45 44 44 47 46 42 46 46 42 45 43 43 41 44 45 42 46 46 43 44 46 45 45 44 45 47 49 43 46 44 47 43 47 44 46 46 46 45 ...
result:
ok n=500000, m=499999, k=120
Test #13:
score: 0
Accepted
time: 2ms
memory: 9728kb
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: 2ms
memory: 9704kb
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: 2ms
memory: 9672kb
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: 2ms
memory: 9740kb
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: 21ms
memory: 11908kb
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: 3ms
memory: 7832kb
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:
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 1...
result:
ok n=239, m=28441, k=239
Test #19:
score: 0
Accepted
time: 1ms
memory: 9900kb
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: 7ms
memory: 13328kb
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: 2ms
memory: 9672kb
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:
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 2 3 4 5 6 7 8 9 10
result:
ok n=30, m=435, k=30
Test #22:
score: 0
Accepted
time: 0ms
memory: 9724kb
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: 0ms
memory: 10680kb
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: 4ms
memory: 13124kb
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:
977 978 979 980 981 982 983 984 985 986 987 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 ...
result:
ok n=988, m=487578, k=988
Test #25:
score: 0
Accepted
time: 12ms
memory: 13252kb
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:
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 ...
result:
ok n=932, m=433846, k=932
Test #26:
score: 0
Accepted
time: 1ms
memory: 9596kb
input:
1 0 1 1
output:
1
result:
ok n=1, m=0, k=1
Test #27:
score: 0
Accepted
time: 2ms
memory: 9720kb
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: 9604kb
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: 14000kb
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:
1 2 3 4 1 2 3 2 3 4
result:
ok n=10, m=9, k=4
Test #30:
score: 0
Accepted
time: 2ms
memory: 14092kb
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:
87 88 91 88 94 14 95 11 22 88 96 15 5 14 12 2 13 99 88 95 20 95 21 87 94 19 15 15 15 8 89 90 93 23 99 16 22 98 95 88 94 1 95 91 23 97 8 23 93 9 22 92 1 7 10 2 16 23 21 95 97 95 15 12 24 10 98 99 94 1 95 91 99 1 6 92 96 26 98 22 5 98 100 12 16 7 89 15 96 10 7 15 22 96 5 88 7 94 89 18 20 89 24 100 91 ...
result:
ok n=1000, m=10000, k=100
Test #31:
score: 0
Accepted
time: 0ms
memory: 11776kb
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:
1 2 2 1 2 2 1 1 3 1
result:
ok n=10, m=15, k=5
Test #32:
score: 0
Accepted
time: 28ms
memory: 21400kb
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:
162 163 163 170 174 199 191 174 198 202 171 171 169 171 176 187 190 193 182 184 172 163 177 200 178 181 189 189 187 173 194 182 167 192 189 179 181 199 184 182 177 182 175 171 184 202 193 171 184 172 181 186 175 174 183 199 172 168 190 194 207 197 188 190 183 192 175 189 199 171 181 188 185 190 184 ...
result:
ok n=30000, m=200000, k=1000
Test #33:
score: 0
Accepted
time: 40ms
memory: 25524kb
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:
98082 98109 98112 98116 98117 98118 98106 98095 98128 98107 98103 98093 98097 98124 98124 98121 98142 98118 98104 98100 98112 98108 98119 98106 98132 98133 98117 98102 98124 98092 98142 98123 98128 98102 98096 98099 98134 98083 98123 98089 98111 98105 98133 98123 98122 98107 98094 98125 98091 98136 ...
result:
ok n=23923, m=239239, k=239239
Test #34:
score: 0
Accepted
time: 25ms
memory: 24912kb
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:
830 917 888 844 865 907 928 911 929 934 857 896 858 890 853 865 844 874 895 873 902 838 900 906 836 843 905 880 842 928 899 869 835 835 910 888 875 852 902 840 929 926 877 840 920 927 913 832 929 905 932 910 882 908 855 863 902 852 909 875 847 916 848 878 840 867 892 858 915 836 918 844 887 891 923 ...
result:
ok n=10000, m=239000, k=1000
Test #35:
score: 0
Accepted
time: 79ms
memory: 31376kb
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:
419 440 458 420 468 492 540 442 496 504 462 534 451 442 467 488 433 458 448 465 464 447 491 508 501 529 445 537 445 482 432 478 461 455 513 470 445 540 490 482 471 448 442 485 434 465 430 488 438 473 496 489 425 476 529 468 440 522 495 539 533 424 494 528 525 540 461 516 453 472 485 436 443 518 490 ...
result:
ok n=20000, m=500000, k=1000
Test #36:
score: 0
Accepted
time: 89ms
memory: 34864kb
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:
19268 19269 19270 19270 19279 19271 19290 19281 19288 19288 19289 19298 19299 19287 19276 19299 19292 19288 19300 19291 19289 19296 19280 19293 19294 19295 19301 19302 19287 19287 19283 19292 19304 19288 19285 19303 19290 19291 19277 19282 19293 19297 19300 19277 19298 19277 19278 19294 19276 19279 ...
result:
ok n=100000, m=500000, k=33000
Test #37:
score: 0
Accepted
time: 106ms
memory: 30920kb
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:
211528 211529 211529 211530 211531 211530 211529 211529 211529 211531 211530 211532 211530 211531 211530 211529 211531 211533 211532 211532 211530 211532 211533 211533 211532 211533 211534 211533 211530 211533 211532 211533 211530 211534 211534 211530 211531 211533 211530 211534 211532 211531 211533...
result:
ok n=500000, m=500000, k=500000
Test #38:
score: 0
Accepted
time: 91ms
memory: 30852kb
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:
17419 17420 17420 17421 17420 17422 17420 17422 17423 17421 17423 17421 17421 17423 17424 17421 17421 17422 17420 17421 17422 17423 17423 17422 17422 17421 17420 17424 17422 17422 17423 17422 17422 17421 17421 17421 17422 17425 17421 17423 17423 17423 17426 17424 17424 17425 17422 17425 17422 17425 ...
result:
ok n=500000, m=499999, k=123901
Test #39:
score: 0
Accepted
time: 85ms
memory: 30068kb
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:
8 9 10 10 1 1 1 2 10 9 9 2 1 1 1 2 2 2 10 2 1 3 1 2 10 1 3 3 4 9 2 2 10 1 3 2 1 2 2 3 1 10 3 4 1 1 4 5 4 10 10 2 2 2 4 10 1 1 4 3 3 3 1 3 2 4 3 1 1 6 4 4 1 3 4 6 2 3 4 4 5 3 5 1 2 2 2 2 3 4 1 6 4 3 5 4 2 7 5 3 4 10 4 2 10 5 5 3 4 7 4 6 4 4 1 2 3 7 6 1 8 9 3 3 4 4 3 8 5 4 6 4 4 5 5 5 6 2 4 6 6 5 7 5 ...
result:
ok n=500000, m=499999, k=10
Test #40:
score: 0
Accepted
time: 2ms
memory: 11768kb
input:
1 0 1 1
output:
1
result:
ok n=1, m=0, k=1
Test #41:
score: 0
Accepted
time: 3ms
memory: 13844kb
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:
1 4 3 2 3 4 3 1 4 1
result:
ok n=10, m=16, k=4
Test #42:
score: 0
Accepted
time: 16ms
memory: 13884kb
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:
1 2 6 3 2 1 5 4 6 4 5 2 3 5 1 6 3 1 2 4 5 2 2 3 3 5 6 6 4 5 1 3 1 4 5 6 6 2 4 6 3 6 1 5 2 2 1 3 3 2 6 1 5 6 2 4 1 6 5 4 3 5 2 2 4 4 2 5 3 3 4 1 6 2 6 5 5 6 2 4 3 3 5 3 5 5 2 1 4 4 2 1 3 2 6 3 4 4 5 4 5 5 2 3 3 2 5 5 4 5 2 1 3 5 3 4 6 2 6 3 4 2 1 4 5 1 5 5 6 3 4 3 5 3 2 5 4 2 3 4 2 1 4 6 6 1 3 5 3 5 ...
result:
ok n=1000, m=9000, k=6
Test #43:
score: -100
Time Limit Exceeded
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...