QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#21345 | #2825. 大碗宽面 | gogo# | AC ✓ | 1662ms | 47068kb | C++14 | 1.6kb | 2022-03-04 16:20:39 | 2022-05-08 02:54:37 |
Judging History
answer
#include <bits/stdc++.h>
//#define int long long
#define ll long long
#define db double
#define fi first
#define se second
#define pii pair<int,int>
#define vi vector<int>
using namespace std;
int m,n[100005],a[10005][505];
int nxt[1000005],pre[1000005],h[100005],w[100005];
struct node {
int id,x;
} b[5000005];
void del(int y,int x) {
if (h[y]==x) {
h[y]=nxt[x];
}
int pr=pre[x],nx=nxt[x];
if (pr) nxt[pr]=nx;
if (nx) pre[nx]=pr;
pre[x]=nxt[x]=0;
}
void ins(int x,int y) {
pre[h[x]]=y;
nxt[y]=h[x];
h[x]=y;
pre[y]=0;
}
int val[10005];
int ans[10005],rk[10005];
int x[10005];
int main() {
scanf("%d",&m);
for (int i=0;i<=1000;i++) h[i]=m+i+1;
int cnt=0;
for (int i=1;i<=m;i++) {
scanf("%d",&n[i]);
for (int j=1;j<=n[i];j++) {
int t;
scanf("%d",&t);
x[j]=t;
cnt++;
b[cnt].id=i,b[cnt].x=t;
}
sort(x+1,x+n[i]+1);
ans[i]^=(i+i+x[(n[i]+1)/2]);
}
sort(b+1,b+cnt+1,[&](node x,node y){
return x.x==y.x?x.id<y.id:x.x<y.x;
});
for (int i=1;i<=m;i++) {
w[i]=n[i];
ins(w[i]+500,i);
}
for (int i=1;i<=cnt;i++) {
int pos=b[i].id;
del(w[pos]+500,pos);
w[pos]-=2;
ins(w[pos]+500,pos);
int x=-w[pos]+500;
for (int p=h[x];p<=m;p=nxt[p]){
if (p==pos) continue ;
ans[p]^=(p+pos+b[i].x);
ans[pos]^=(p+pos+b[i].x);
}
x--;
for (int p=h[x];p<=m;p=nxt[p]){
if (p==pos) continue ;
ans[p]^=(p+pos+b[i].x);
ans[pos]^=(p+pos+b[i].x);
}
}
for (int i=1;i<=m;i++) {
printf("%d\n",ans[i]);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1570ms
memory: 47040kb
input:
10000 500 859366524 799639632 478076363 151604321 607428939 233690027 688301763 751626556 522306660 536984621 678633141 10578133 793244142 296437947 543452728 219588017 242235086 875832010 439306786 621619872 896296190 855348805 322308598 264128973 159679782 141772327 531429282 34093406 776807465 22...
output:
1067427185 39974308 1013395314 92517059 34948556 954314749 1019304725 81852217 14309044 54130846 35792652 1034202845 93901788 1032937383 98299641 71419938 70902930 976383972 1031643060 1010313104 1006450452 28189852 86943269 46288302 998291304 83807081 1027308959 23261403 995953387 1000623412 426439...
result:
ok 10000 lines
Test #2:
score: 0
Accepted
time: 1516ms
memory: 46932kb
input:
10000 500 798254894 598183457 188492366 213343500 144024969 207571951 470634101 33909699 797976261 987433900 965740329 414192594 225990846 16409557 927106922 121246302 126239507 124080119 621042082 842641728 725791146 297984743 849070111 813339625 962031535 552579090 667865219 190108719 612404865 83...
output:
941842913 76756424 984265872 91718581 46075887 83617387 100143500 61029346 1029115789 1072666963 125695997 109138178 25122426 74481547 7392266 1042520568 973853031 12969101 73891891 73600185 1073702433 1038100420 93881633 995390588 31169406 126128916 35152535 131551860 50231694 975673455 976894787 6...
result:
ok 10000 lines
Test #3:
score: 0
Accepted
time: 870ms
memory: 47068kb
input:
10000 500 1 1 0 0 1 1 1 0 0 0 0 0 1 1 0 1 1 0 0 1 0 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 1 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 0 0 1 0 0 1 0 1 1 1 1 1 0 0 0 1 1 1 1 0 1 1 1 0 1 1 0 1 1 0 0 1 0 ...
output:
3793 168 1026 7361 111 7924 5675 14936 33 9130 721 6977 8662 9029 208 10028 23 10209 10077 14294 6087 962 368 11966 7237 1227 4246 8886 10066 14996 16062 295 11931 573 14239 14120 14026 9984 1798 9952 1329 8249 1535 9076 8813 6068 11687 15534 10029 667 800 3135 15469 8290 13559 9688 15157 358 391 43...
result:
ok 10000 lines
Test #4:
score: 0
Accepted
time: 1605ms
memory: 44332kb
input:
10000 499 336877261 26362245 973593660 767344833 254149914 924437975 7702640 208740280 983230139 158667687 4663145 114489254 887987788 24594914 936420052 213343501 126344736 883392030 4523436 284383841 828950796 511521744 59140803 156289177 44906199 992436310 247903279 395981697 987433901 425899815 ...
output:
807486028 891293819 261741040 469550235 438622955 502240134 1020170815 786155514 200012834 300923795 97956218 216773482 461746241 295598620 431574498 467873694 202922246 21578115 383502596 413057482 810175322 112838736 246729133 362626304 675427139 37113891 967219300 231354476 900969847 231684200 26...
result:
ok 10000 lines
Test #5:
score: 0
Accepted
time: 1585ms
memory: 43664kb
input:
10000 499 794283717 121003282 798084749 890678492 1351179 937533223 34093407 934931895 76872698 307784 33517122 905434213 91907566 164929402 872918843 824856622 102663700 106274628 923185661 486582427 98427856 950253378 47165093 998051999 170889435 981409462 833284370 10578134 3697214 114527674 7706...
output:
1055931898 477296557 463136746 680402397 536394216 829787301 221056371 49324134 704670552 65906308 127225518 485464935 1030017247 157167505 834023362 90265654 547009735 930699678 965939751 351800808 157347030 856741179 216897925 824828071 11807304 101078913 815907707 809897987 857154999 5833218 2245...
result:
ok 10000 lines
Test #6:
score: 0
Accepted
time: 1609ms
memory: 44568kb
input:
10000 500 999999961 999999941 999999927 999999573 999999985 999999620 999999529 999999979 999999938 999999929 999999615 999999870 999999832 999999874 999999632 999999749 999999941 999999751 999999659 999999698 999999722 999999643 999999519 999999672 999999841 999999508 999999820 999999597 999999717 ...
output:
11068 7895 15171 14094 12800 6461 4911 10202 4381 3251 11004 16380 8287 4311 7791 9388 14469 12331 7494 2356 3227 1819 158 13646 1420 12682 12679 12901 39 1204 4444 12766 11281 13520 6955 14501 4428 32 4957 11644 174 8653 6420 11724 4698 948 1716 4087 3601 1397 14080 884 14872 12418 10330 10218 1176...
result:
ok 10000 lines
Test #7:
score: 0
Accepted
time: 1662ms
memory: 44148kb
input:
10000 500 999999908 999999972 999999977 999999619 999999866 999999552 999999834 999999951 999999881 999999565 999999695 999999967 999999560 999999564 999999641 999999912 999999738 999999597 999999987 999999834 999999777 999999523 999999949 999999920 999999655 999999813 999999843 999999984 999999707 ...
output:
13877 7472 14720 16279 15657 14138 4982 4966 13249 672 13220 6976 14775 3541 1766 11951 7683 8644 6073 2361 7393 12340 815 5106 9350 5714 3069 15117 15521 15470 11381 11286 12965 12233 7423 14408 11609 6315 7730 11906 12910 5362 4154 11058 8595 4507 652 5177 2539 624 9792 11170 10312 353 13677 6130 ...
result:
ok 10000 lines
Test #8:
score: 0
Accepted
time: 21ms
memory: 7924kb
input:
5000 2 0 0 2 0 0 2 0 1 1 0 1 1 2 0 1 2 1 1 2 1 0 1 0 1 0 2 1 0 2 0 1 2 0 1 2 1 0 1 0 2 0 0 1 1 2 1 1 1 1 1 1 2 1 1 2 0 1 1 0 1 1 1 1 2 0 1 1 0 1 0 1 1 1 1 2 1 1 1 0 1 1 1 1 1 0 2 1 1 1 1 1 0 1 1 2 0 0 1 1 1 1 2 1 0 1 0 1 0 1 0 2 0 0 2 1 1 2 1 0 1 1 2 0 1 2 0 1 1 0 1 1 2 1 0 2 0 0 1 0 1 0 1 1 2 0 1 1...
output:
0 5000 6342 4742 3014 4586 2913 5550 1630 4794 6918 630 1130 3674 178 5000 2638 623 314 6662 4897 7402 4210 2158 2622 5482 306 5094 4038 5826 4705 5086 4558 5362 178 7203 6214 4986 4362 5016 3358 7122 1286 4326 3110 4458 0 8131 7626 4242 1222 6998 678 290 2318 5112 2494 3290 7850 7574 3654 6458 7314...
result:
ok 5000 lines