QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#390797 | #8547. Whose Land? | ucup-team134 | RE | 2810ms | 99212kb | C++17 | 6.1kb | 2024-04-15 21:57:42 | 2024-04-15 21:57:42 |
Judging History
answer
#include <bits/stdc++.h>
#define ff first
#define ss second
#define ll long long
#define pb push_back
using namespace std;
typedef pair<int,int> pii;
struct BIT{
vector<int>a;
int n;
BIT(int n){
this->n=n;
a.resize(n+1);
}
void upd(int x,int val){
while(x<=n){
a[x]+=val;
x+=(x&(-x));
}
}
int get(int x){
int ret=0;
while(x){
ret+=a[x];
x-=(x&(-x));
}
return ret;
}
int get(int l,int r){
return get(r)-get(l-1);
}
};
struct bset{
set<pair<pii,int>>st;
void dodaj(int l,int r,int v,vector<pair<pii,pii>>&ret){
//printf("%d %d %d DODAJ\n",l,r,v);
if(r-l<0)return;
st.insert({{l,r},v});
ret.pb({{l,r},{v,1}});
}
void skini(int l,int r,int v,vector<pair<pii,pii>>&ret){
if(r-l<0)return;
st.erase({{l,r},v});
ret.pb({{l,r},{v,-1}});
}
int get_val(int x){
auto it=st.lower_bound({{x,-1},-1});
if(it==st.end() || (*it).ff.ff>x)it--;
return (*it).ss;
}
vector<pair<pii,pii>> upd(int l,int r,int v){
///printf("%d %d %d START\n",l,r,v);
//ispis();
auto it=st.lower_bound({{l,-1},-1});
if(it==st.end() || (*it).ff.ff>l)it--;
vector<pair<pii,int>>ret;
//printf("OPALA\n");
while(it!=st.end()){
ret.pb((*it));
it++;
if(it==st.end() || (*it).ff.ff>r)break;
}
//printf("OPALA2\n");
vector<pair<pii,pii>>realret;
for(int i=0;i<ret.size();i++){
//printf("%d %d %d SKIDAM\n",ret[i].ff.ff,ret[i].ff.ss,ret[i].ss);
skini(ret[i].ff.ff,ret[i].ff.ss,ret[i].ss,realret);
}
///printf("OPALA3\n");
int sz=ret.size();
///printf("OPALA7 %d\n",ret.size());
dodaj(ret[0].ff.ff,min(ret[0].ff.ss,l-1),ret[0].ss,realret);
///printf("OPALA6\n");
dodaj(max(ret[sz-1].ff.ff,r+1),ret[sz-1].ff.ss,ret[sz-1].ss,realret);
//printf("OPALA4\n");
dodaj(l,r,v,realret);
//printf("OPALA5\n");
//printf("%d %d %d SET UPDATE\n",l,r,v);
//ispis();
return realret;
}
void ispis(){
for(auto it=st.begin();it!=st.end();it++){
printf("%d %d %d | ",(*it).ff.ff,(*it).ff.ss,(*it).ss);
}
printf(" ISPIS\n");
}
};
const int maxn = 1e5 + 10;
const int maxk=45;
int n, k, q;
vector<int>vect[maxn],niz[maxn];
int lp[maxn][maxk],rp[maxn][maxk],level[maxn],p[maxn],xpos[maxn];
int rez[maxn];
vector<pii>ql[maxn],qr[maxn];
int ofs=22;
void prek(int x,int prv,int lvl){
p[x]=prv;
level[x]=lvl;
xpos[x]=niz[lvl].size();
niz[lvl].pb(x);
lp[x][ofs]=niz[lvl].size()-1;
rp[x][ofs]=niz[lvl].size()-1;
for(int i=0;i<vect[x].size();i++){
int id=vect[x][i];
if(id==prv)continue;
prek(id,x,lvl+1);
for(int j=1;j<=k;j++){
lp[x][ofs+j]=min(lp[x][ofs+j],lp[id][ofs+j-1]);
rp[x][ofs+j]=max(rp[x][ofs+j],rp[id][ofs+j-1]);
}
}
}
void prek2(int x,int prv){
for(int i=0;i<vect[x].size();i++){
int id=vect[x][i];
if(id==prv)continue;
prek2(id,x);
}
int curr=p[x];
int d=-1;
for(int i=1;i<=k && curr!=-1;i++){
for(int j=0;j<=k+d;j++){
lp[x][ofs+d+j]=min(lp[x][ofs+d+j],lp[curr][ofs+j]);
rp[x][ofs+d+j]=max(rp[x][ofs+d+j],rp[curr][ofs+j]);
}
d--;
curr=p[curr];
}
}
void go_left(){
vector<bset>bsets(n+1);
vector<BIT>bits;
for(int i=0;i<=n;i++)bits.pb(BIT(niz[i].size()));
BIT global(n+1);
for(int i=1;i<=n;i++){
if(niz[i].size()==0)continue;
bsets[i].st.insert({{0,niz[i].size()-1},n+1});
for(int j=0;j<niz[i].size();j++)
bits[i].upd(j+1,1);
}
global.upd(n+1,n);
///printf("dosao\n");
for(int i=n;i>=1;i--){
for(int j=ofs-k;j<=ofs+k;j++){
if(lp[i][j]>rp[i][j])continue;
int lvl=level[i]+j-ofs;
///printf("%d JU\n",lvl);
vector<pair<pii,pii>>cand=bsets[lvl].upd(lp[i][j],rp[i][j],i);
///printf("%d JU\n",lvl);
for(int k=0;k<cand.size();k++){
int d=cand[k].ss.ss;
int id=cand[k].ss.ff;
int l=cand[k].ff.ff;
int r=cand[k].ff.ss;
int c=bits[lvl].get(l+1,r+1);
global.upd(id,d*c);
}
}
///printf("%d done\n",i);
bits[level[i]].upd(xpos[i]+1,-1);
int v=bsets[level[i]].get_val(xpos[i]);
global.upd(v,-1);
/*printf("BESTS\n");
for(int j=1;j<=n;j++){
bsets[j].ispis();
}*/
for(int j=0;j<ql[i].size();j++){
int r=ql[i][j].ff;
int id=ql[i][j].ss;
rez[id]+=global.get(i,r);
///printf("%d %d | %d LEFT\n",i,r,global.get(i,r));
}
}
}
void go_right(){
vector<bset>bsets(n+1);
vector<BIT>bits;
for(int i=0;i<=n;i++)bits.pb(BIT(niz[i].size()));
BIT global(n+1);
for(int i=1;i<=n;i++){
if(niz[i].size()==0)continue;
bsets[i].st.insert({{0,niz[i].size()-1},n+1});
for(int j=0;j<niz[i].size();j++)
bits[i].upd(j+1,1);
}
global.upd(n+1,n);
for(int i=1;i<=n;i++){
for(int j=ofs-k;j<=ofs+k;j++){
if(lp[i][j]>rp[i][j])continue;
int lvl=level[i]+j-ofs;
vector<pair<pii,pii>>cand=bsets[lvl].upd(lp[i][j],rp[i][j],i);
for(int k=0;k<cand.size();k++){
int d=cand[k].ss.ss;
int id=cand[k].ss.ff;
int l=cand[k].ff.ff;
int r=cand[k].ff.ss;
int c=bits[lvl].get(l+1,r+1);
global.upd(id,d*c);
}
}
bits[level[i]].upd(xpos[i]+1,-1);
int v=bsets[level[i]].get_val(xpos[i]);
global.upd(v,-1);
for(int j=0;j<qr[i].size();j++){
int l=qr[i][j].ff;
int id=qr[i][j].ss;
rez[id]+=global.get(l,i);
///printf("%d %d | %d right\n",l,i,global.get(l,i));
}
}
}
int main(){
///freopen("test.txt","r",stdin);
int t;
scanf("%d",&t);
while (t--) {
scanf("%d %d %d",&n,&k,&q);
for (int i = 1; i <= n; i++){
vect[i].clear();
niz[i].clear();
ql[i].clear();
qr[i].clear();
for(int j=0;j<maxk;j++){
lp[i][j]=n+1;
rp[i][j]=-1;
}
}
for (int i = 1; i < n; i++) {
int u, v;
scanf("%d %d", &u, &v);
vect[u].pb(v);
vect[v].pb(u);
}
prek(1,-1,1);
prek2(1,-1);
for(int i=1;i<=q;i++){
int l,r;
scanf("%d %d",&l,&r);
ql[l].pb({r,i});
qr[r].pb({l,i});
rez[i]=r-l+1;
}
go_left();
go_right();
for(int i=1;i<=q;i++){
printf("%d\n",rez[i]);
}
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 19208kb
input:
2 5 1 2 1 2 1 3 2 4 2 5 2 2 2 3 8 2 3 1 2 1 3 2 4 2 5 4 6 5 7 7 8 2 2 2 5 3 4
output:
4 5 7 8 6
result:
ok 5 number(s): "4 5 7 8 6"
Test #2:
score: 0
Accepted
time: 858ms
memory: 19628kb
input:
1000 500 1 500 291 2 406 9 207 13 71 15 351 17 442 18 496 19 104 20 208 23 448 34 80 42 187 44 352 45 290 46 116 47 318 50 226 52 129 55 83 59 100 60 54 61 73 65 63 66 454 67 43 71 26 74 68 26 320 75 388 76 425 79 170 81 350 83 48 85 153 86 221 90 290 95 130 96 82 98 124 82 36 99 213 100 121 101 132...
output:
255 386 356 124 315 330 437 8 335 423 398 338 180 242 352 500 145 44 342 261 92 326 38 291 259 71 137 456 171 24 162 453 283 325 250 319 478 460 77 354 56 393 372 217 395 265 188 256 134 68 205 429 436 346 300 462 324 170 291 406 207 480 198 182 489 61 476 127 289 204 282 374 114 406 488 366 121 190...
result:
ok 500000 numbers
Test #3:
score: 0
Accepted
time: 1007ms
memory: 17748kb
input:
1000 500 2 500 260 2 93 3 399 4 227 5 238 6 382 7 35 12 194 24 141 26 463 27 497 30 102 31 410 32 308 34 357 42 271 43 208 44 446 46 262 50 457 51 467 52 294 53 424 54 267 56 210 58 48 59 339 48 407 65 320 66 33 68 78 33 79 71 315 72 390 74 128 76 83 81 244 87 375 91 79 93 225 94 1 97 433 1 172 100 ...
output:
496 471 423 489 270 388 451 329 495 104 453 321 500 357 24 429 409 496 491 454 469 119 495 460 432 450 496 494 459 435 211 298 426 260 371 490 498 259 490 494 492 477 336 412 425 431 235 445 482 422 296 495 361 407 465 492 497 500 394 222 500 500 500 498 470 470 152 414 337 412 325 387 89 492 313 45...
result:
ok 500000 numbers
Test #4:
score: 0
Accepted
time: 1207ms
memory: 19832kb
input:
1000 500 3 500 333 1 268 2 183 3 394 5 420 7 322 12 87 14 285 21 178 23 82 36 106 38 28 49 364 28 30 56 110 57 211 58 486 62 456 66 337 67 222 68 175 76 15 81 489 82 79 91 376 79 274 93 417 94 302 96 457 98 142 102 486 103 13 104 186 111 128 114 35 115 184 117 167 118 156 119 429 120 414 122 84 126 ...
output:
478 489 465 360 439 28 488 133 75 497 373 470 496 499 487 141 476 500 381 489 495 171 414 372 449 236 489 422 432 373 488 298 480 473 98 500 474 496 449 446 500 487 110 213 499 446 152 283 322 497 304 245 371 218 323 500 416 485 499 439 480 430 489 496 488 405 483 500 339 476 483 497 494 309 258 358...
result:
ok 500000 numbers
Test #5:
score: 0
Accepted
time: 1365ms
memory: 19528kb
input:
1000 500 4 500 109 1 252 5 375 6 50 7 398 11 465 13 127 14 79 15 112 18 301 20 23 22 442 27 219 31 48 35 351 36 460 37 368 40 465 43 16 45 79 48 383 50 32 53 42 32 496 42 54 56 193 54 187 61 93 62 389 63 147 65 86 66 231 67 261 70 365 71 249 88 181 90 77 94 437 98 384 101 411 102 64 103 364 104 456 ...
output:
500 497 379 500 248 492 499 500 325 384 492 365 395 491 130 435 496 340 500 500 478 470 500 346 499 495 164 496 499 498 500 500 326 432 444 500 500 480 500 328 486 500 500 90 463 499 48 387 500 495 478 446 488 81 487 426 500 490 488 351 499 500 497 500 362 431 249 495 491 495 500 494 367 500 420 496...
result:
ok 500000 numbers
Test #6:
score: 0
Accepted
time: 1006ms
memory: 22008kb
input:
100 5000 1 5000 4598 1 104 3 1813 7 3677 9 4212 10 739 14 4927 16 3896 17 2012 23 4512 25 1751 26 1487 29 2610 30 3912 31 733 33 4844 39 1179 40 5 43 174 45 4787 47 2500 48 3783 50 2905 54 1943 55 1296 56 4178 59 1021 63 4614 70 4221 71 4782 74 1802 75 4912 76 1839 80 4494 81 3403 82 2355 84 756 91 ...
output:
4366 4531 4868 2824 4359 2428 880 3967 4469 3414 4891 1139 611 577 698 4669 1641 2897 520 3730 3629 3913 4701 2735 4626 3279 2037 4040 3401 4845 4911 3015 2878 1753 4669 1094 4319 725 1266 2479 4360 3242 4056 1078 1047 4924 3570 2632 4852 2234 2498 4150 3357 2454 4784 3937 1272 1416 4942 3514 1315 3...
result:
ok 500000 numbers
Test #7:
score: 0
Accepted
time: 1186ms
memory: 23928kb
input:
100 5000 2 5000 2567 6 2087 9 801 12 2832 16 3395 23 1178 25 479 30 1690 32 4253 36 2131 37 4668 38 4210 41 4361 47 1930 48 3486 50 3592 52 3956 54 2514 61 1045 64 1348 68 2708 69 300 72 62 73 2064 74 1166 75 3404 77 1292 79 1905 80 358 81 1083 83 4914 86 4642 87 1914 88 4435 92 3514 97 352 100 1167...
output:
4949 4725 4640 4959 4301 1730 4557 4625 4988 2646 276 4021 3492 4707 703 4961 2898 90 4986 3757 4981 3492 3954 4901 4254 798 4972 1580 2928 3446 495 4314 4621 4460 4906 3313 4665 4832 3988 4604 3784 3932 4990 3989 4655 2270 525 4891 4989 4293 4296 4359 4033 4438 4939 4926 1197 4962 4011 4544 3909 15...
result:
ok 500000 numbers
Test #8:
score: 0
Accepted
time: 1467ms
memory: 24204kb
input:
100 5000 3 5000 1343 1 3262 3 4789 7 1988 19 4873 24 1618 25 223 29 4077 36 2982 37 1646 38 2585 40 1532 50 4623 52 4948 54 431 57 45 59 1734 45 23 61 428 72 205 75 2916 84 4521 86 1819 88 1376 92 1036 93 334 96 4666 101 4 102 3790 104 895 105 1810 110 2075 114 4285 116 1673 117 1728 118 1453 120 42...
output:
1572 4742 2171 3564 4050 4970 5000 1152 3804 4896 4672 2800 2161 4889 4683 4293 3578 4921 4915 3966 3694 4590 4996 4772 4547 3956 5000 4865 2930 4919 4990 4998 4994 4995 4805 5000 4382 4201 4702 4612 4360 4919 4789 4027 4924 3265 855 4730 2721 4814 4927 4628 1307 3772 4238 3797 4912 4755 4854 2505 4...
result:
ok 500000 numbers
Test #9:
score: 0
Accepted
time: 1705ms
memory: 21824kb
input:
100 5000 4 5000 2416 3 246 5 1481 10 1143 15 1759 18 4762 19 2262 26 4167 31 223 32 1969 34 4694 35 4255 36 1373 39 670 44 479 45 2985 48 3024 50 2533 52 2107 62 3254 64 1636 65 1038 66 1680 71 689 73 3202 74 3753 82 4937 84 2295 87 4926 89 3004 91 2218 92 4101 93 2064 98 3910 99 1839 102 1746 103 5...
output:
4254 4911 4148 3692 4971 4940 4114 4433 4950 4881 4998 4982 4715 4982 4701 4864 4746 4856 4988 4996 2562 2235 4878 5000 4931 4934 4738 2950 5000 3608 4759 3076 3608 4877 4996 4601 2379 4793 4973 4967 4865 4697 3813 4984 4991 4929 3808 3482 4992 4472 4960 4840 504 4974 4425 4494 3791 4903 5000 5000 4...
result:
ok 500000 numbers
Test #10:
score: 0
Accepted
time: 1120ms
memory: 36384kb
input:
25 20000 1 20000 16985 7 9470 9 7497 10 12601 13 19428 19 17396 21 13606 27 1463 28 5720 30 6405 31 16086 38 15453 39 10225 41 19740 44 9398 47 18437 49 7152 50 15684 53 13034 55 12112 56 8888 57 6096 66 375 68 19456 78 13234 84 7828 85 5767 97 13148 99 2185 100 3817 101 8 102 14096 8 13295 103 1319...
output:
13854 10421 498 18438 1916 8252 18032 204 18543 18005 5196 13629 12160 15228 7004 6117 2367 14659 5032 17464 18124 10547 12996 16457 17785 3014 19175 9640 5413 15842 18032 1604 14411 9820 7143 5901 8433 7473 17041 15802 18371 12383 15085 18914 3416 2516 18654 5701 9060 10826 19761 6019 3797 7595 188...
result:
ok 500000 numbers
Test #11:
score: 0
Accepted
time: 1304ms
memory: 36520kb
input:
25 20000 2 20000 7250 2 18350 5 4189 8 19461 9 3610 11 10539 13 13349 14 14257 18 12153 22 16728 27 899 30 7367 36 14679 40 17758 41 19047 46 14890 47 14929 49 3193 50 7417 52 18673 57 19096 60 7613 61 9428 62 9576 63 400 64 19758 65 4549 69 2735 70 18322 74 18630 76 14608 78 1529 86 10666 92 435 93...
output:
11555 19950 10702 18264 18983 17767 16022 17567 8482 17678 19659 18692 19822 9299 11016 3283 15127 2364 18320 19204 14616 19990 19817 18719 19639 19986 13080 2437 16101 9004 17041 9904 17431 19887 19350 16813 12983 13196 15307 12404 19576 18723 19312 19939 14506 17131 19337 16306 1184 18831 11189 11...
result:
ok 500000 numbers
Test #12:
score: 0
Accepted
time: 1592ms
memory: 36468kb
input:
25 20000 3 20000 6027 3 10333 6 15473 11 6320 13 7792 18 10979 19 16197 20 14348 21 1690 22 18539 23 8816 24 15089 27 2238 29 8480 32 3288 36 11342 38 2707 39 6511 46 9096 48 5234 50 14712 53 1834 55 6993 57 11184 58 16078 59 18984 61 14820 67 834 68 1754 69 739 71 5016 75 16259 76 741 77 7672 78 17...
output:
19995 11051 12978 17914 19999 19713 12058 19593 19724 15828 11867 19669 11178 16495 16527 19229 19672 13102 19832 14098 8043 14132 18754 19962 19907 18253 8055 16458 19994 8083 17818 19669 16527 12600 19899 19835 19052 19205 20000 19163 12602 7820 19974 19415 19848 19932 12182 18623 19923 18872 1994...
result:
ok 500000 numbers
Test #13:
score: 0
Accepted
time: 1834ms
memory: 35904kb
input:
25 20000 4 20000 4803 2 6508 3 16357 5 476 6 11975 9 7227 12 8645 15 14438 17 8124 19 1566 20 16733 24 2812 26 13988 29 19202 31 16041 35 19283 36 10485 44 14020 46 7672 47 3283 51 729 54 16055 56 19149 62 1305 66 15949 67 2402 73 8194 82 3125 84 17890 85 2847 87 15424 88 10989 89 3520 91 3422 93 15...
output:
17587 19806 15971 19999 19916 2339 19126 19669 19827 19855 18914 8252 18137 20000 6547 20000 19739 19347 18714 19997 15367 14785 19999 19806 19959 19749 19952 15761 19974 18783 19985 18745 19996 18967 19996 19986 13738 18954 19058 17559 2569 19978 19557 8258 13529 19449 19999 19971 5922 11608 19960 ...
result:
ok 500000 numbers
Test #14:
score: 0
Accepted
time: 1331ms
memory: 99212kb
input:
5 100000 1 100000 65452 1 39581 2 51138 3 77143 4 56934 5 11457 7 57146 9 21536 11 4708 12 57852 13 97500 22 76022 23 96583 27 36441 32 30948 35 53232 36 50629 37 79639 38 61377 43 78772 46 41320 47 2344 49 86775 52 63201 57 53901 59 59314 61 95358 62 94950 63 44230 66 99217 69 57344 70 92488 86 961...
output:
99907 37316 85362 3534 84069 55160 74579 5575 50463 67247 697 29352 5606 95882 66442 85534 40921 69176 19195 85386 20900 70472 89510 77618 77039 39606 14908 36890 26439 23200 87029 75059 74992 79899 85273 72156 7678 3593 47438 97802 33899 98258 98991 41669 32763 17643 59525 89407 85433 68525 97000 4...
result:
ok 500000 numbers
Test #15:
score: 0
Accepted
time: 1731ms
memory: 87664kb
input:
5 100000 1 100000 1 2 1 3 2 4 2 5 2 6 2 7 2 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 4 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 6 36 6 37 6 38 6 39 6 40 6 41 6 42 6 43 6 44 6 45 6 46 6 47 6 48 7 49 7 50 7 51 7 52 7 53 7 54 7 55 7 56 7 57 7 58 7 59 ...
output:
21130 36114 7444 10651 62296 52897 57960 18815 85327 24367 51801 99990 52822 9714 31264 26349 34748 22707 57437 37755 32365 37242 76963 55542 26580 65184 31304 33380 54513 23932 46606 15047 28922 9680 8618 37505 28082 15321 288 40093 29299 358 16183 43463 34415 77460 4058 45276 40816 46486 19831 716...
result:
ok 500000 numbers
Test #16:
score: 0
Accepted
time: 1402ms
memory: 97976kb
input:
5 100000 2 100000 76932 1 78860 5 2422 6 76707 9 61116 15 80408 23 49594 27 54330 31 31141 32 60879 35 45417 37 23745 40 76845 44 67163 48 60597 49 49684 53 74215 56 19852 57 3056 59 49525 60 84232 62 96565 63 11636 65 77513 70 21067 80 78540 81 81436 82 80345 84 87662 88 34030 91 19240 93 27218 98 ...
output:
76095 98899 9025 99567 99578 70068 11140 78199 89234 46003 78984 74240 98884 89176 92940 26610 90572 90839 99981 91884 95971 40037 96277 20283 99462 83734 98101 95386 99961 62674 90668 93128 82592 73459 63709 34540 93008 97732 88015 99995 99136 50241 7310 99977 39843 34712 70746 54982 79470 76423 81...
result:
ok 500000 numbers
Test #17:
score: 0
Accepted
time: 1982ms
memory: 85788kb
input:
5 100000 2 100000 1 2 1 3 2 4 2 5 2 6 2 7 2 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 4 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 6 36 6 37 6 38 6 39 6 40 6 41 6 42 6 43 6 44 6 45 6 46 6 47 6 48 7 49 7 50 7 51 7 52 7 53 7 54 7 55 7 56 7 57 7 58 7 59 ...
output:
28252 62610 31438 16964 6451 10376 8623 14823 45365 73013 71149 17372 15626 42256 14328 9700 55941 60538 77721 14033 15164 6035 26990 3331 88702 71743 36189 29586 40813 73544 11663 20653 34054 39889 25549 67837 66756 75188 26213 895 38693 41421 44040 11332 11981 24240 47568 55600 9924 23782 43083 11...
result:
ok 500000 numbers
Test #18:
score: 0
Accepted
time: 1624ms
memory: 98080kb
input:
5 100000 3 100000 47197 1 83547 6 86410 7 10862 10 65298 16 40848 25 76634 28 54420 29 678 30 22690 42 93335 49 4171 50 48596 51 97885 53 646 54 13433 56 54697 57 27362 59 1632 60 63382 65 27145 66 58082 67 60689 68 67633 70 20938 75 89254 79 91707 81 22636 83 31095 84 36139 85 22353 89 61948 98 562...
output:
98939 97484 97443 99904 97552 99116 97764 99685 99741 61980 73380 25913 92250 88988 41383 81703 81770 83176 81850 93131 81253 78738 99979 99250 99333 99010 94702 69698 22850 89211 97117 95557 99999 15380 77615 81659 40331 61428 98290 99773 99512 98270 92960 97906 94609 91495 89053 91645 84264 100000...
result:
ok 500000 numbers
Test #19:
score: 0
Accepted
time: 2408ms
memory: 86708kb
input:
5 100000 3 100000 1 2 1 3 2 4 2 5 2 6 2 7 2 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 4 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 6 36 6 37 6 38 6 39 6 40 6 41 6 42 6 43 6 44 6 45 6 46 6 47 6 48 7 49 7 50 7 51 7 52 7 53 7 54 7 55 7 56 7 57 7 58 7 59 ...
output:
2517 12676 20408 57281 7595 42442 2448 82869 28402 88703 79345 49001 35480 65714 28344 31260 12386 10562 4254 14944 3934 72264 32611 31456 6868 48169 26843 25656 761 2727 4913 34782 39756 22594 34667 26604 71945 1557 15679 35523 70515 83572 46759 59314 23068 30338 10023 5431 49823 53109 22627 51338 ...
result:
ok 500000 numbers
Test #20:
score: 0
Accepted
time: 1969ms
memory: 98248kb
input:
5 100000 4 100000 25974 1 79723 5 3102 6 45017 16 36777 17 1288 20 12185 31 54510 33 59816 34 25717 37 41252 38 76086 45 28858 52 95904 54 64886 55 77181 58 2474 59 10679 62 43311 70 77239 74 37353 77 52303 78 85550 81 81946 83 20808 86 8481 87 77785 88 32223 90 50335 92 95143 100 84249 101 29381 10...
output:
99846 91739 81090 99991 99840 99983 100000 98356 89839 92229 83694 99993 75930 99794 85462 75257 85935 99996 99988 99835 99373 75538 99984 64381 95516 97643 48556 92269 96576 99263 42473 99999 99562 99941 95166 99846 96992 76520 99957 99890 27407 98364 75077 98943 97953 22998 64347 98053 41631 99999...
result:
ok 500000 numbers
Test #21:
score: 0
Accepted
time: 2810ms
memory: 85684kb
input:
5 100000 4 100000 1 2 1 3 2 4 2 5 2 6 2 7 2 8 3 9 3 10 3 11 3 12 3 13 3 14 3 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 4 24 5 25 5 26 5 27 5 28 5 29 5 30 5 31 5 32 5 33 5 34 5 35 6 36 6 37 6 38 6 39 6 40 6 41 6 42 6 43 6 44 6 45 6 46 6 47 6 48 7 49 7 50 7 51 7 52 7 53 7 54 7 55 7 56 7 57 7 58 7 59 ...
output:
18029 73730 28521 45218 40759 69068 71615 32980 14951 22129 40759 90245 32980 8129 79674 96189 62950 37071 32980 31979 62950 34544 27189 73730 34544 36177 10617 22129 61733 51039 44921 18029 59159 34544 34544 34544 49495 22129 90245 77188 38355 44217 99017 40759 49495 71615 51039 90245 18029 24585 3...
result:
ok 500000 numbers
Test #22:
score: -100
Runtime Error
input:
1 100000 6 500000 16295 6 87763 7 84391 9 85895 14 46464 17 77083 27 78531 31 37918 33 83051 35 72940 36 57210 39 9656 40 45218 43 907 44 21638 45 99499 48 72032 50 34752 52 10436 54 5812 71 83845 72 42746 74 77175 76 8657 78 14101 79 93672 83 38565 87 50244 88 17562 92 15777 93 1561 94 19671 95 507...