QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#735760 | #9610. 游戏 | xyz123 | 20 | 364ms | 520852kb | C++23 | 1.9kb | 2024-11-11 21:34:49 | 2024-11-11 21:34:53 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,q,w,sum[200005],cn,lim=5000000;
long long an1[10000005];
unsigned long long ann[10000005],an[10000005],ans;
long long sm1[10000005],sm2[10000005];
int d[5000005],v[5000005],cnn;
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}return x*f;}
struct p{long long l,r;}l[200005];
struct pp{long long q,w;}dp[5001][5001];
void ins(int ll,int rr,long long q1,long long q2)
{
if(ll>rr) return;
// cout<<ll<<" "<<rr<<" "<<q1<<"\n";
sm1[ll]+=q1,sm1[rr+1]-=q1;
sm2[ll]+=q2,sm2[rr+1]-=q2;
}
int main()
{
// freopen("game17.in","r",stdin);
// freopen("game17.ans","w",stdout);
a=read(),b=read(),c=read();
for(int i=1;i<=a;i++)
{
q=read(),w=read();
d[i]=q;
}
long long L=1;
for(int i=1;i<=a;i++)
{
if(i==a) dp[i][i]=pp{L,lim};
else dp[i][i]=pp{L,(d[i]+d[i+1])/2};
L=dp[i][i].w+1;
ins(dp[i][i].q,dp[i][i].w,d[i],0);
}
for(int i=2;i<=a;i++)
{
for(int j=1;j<=a-i+1;j++)
{
int r=j+i-1;
int l1,r1,l2,r2;
int ml=1e9,mr=0;
l1=dp[j][r-1].q,r1=dp[j][r-1].w;
l2=dp[j+1][r].q,r2=dp[j+1][r].w;
if(i%2==1)
{
if(j>1)
{
l1=max(l1,(d[j-1]+d[r])/2+1);
}
if(r<a)
{
r2=min(r2,(d[j]+d[r+1])/2);
}
if(l1<=r1) ml=min(ml,l1),mr=max(mr,r1),ins(l1,r1,d[r],0);
if(l2<=r2) ml=min(ml,l2),mr=max(mr,r2),ins(l2,r2,d[j],0);
}
else
{
if(j>1)
{
l1=max(l1,(d[j-1]+d[r]-2)/2+1);
}
if(r<a)
{
r2=min(r2,(d[j]+d[r+1]-2)/2);
}
if(l1<=r1) ml=min(ml,l1),mr=max(mr,r1);
if(l2<=r2) ml=min(ml,l2),mr=max(mr,r2);
}
dp[j][r]=pp{ml,mr};
}
}
for(int i=1;i<=lim;i++) sm1[i]+=sm1[i-1];
for(int i=0;i<=lim;i++) an[i]=sm1[i];
for(int i=1;i<=b;i++)
{
q=read();
if(c==0) ans=ans^(ann[q]*i);
else ans=ans^(an[q]*i);
}
printf("%llu",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 297ms
memory: 520852kb
input:
5000 2000 0 115 126 1542 1589 1770 1774 2876 2915 3533 3539 7176 7176 7734 7767 8709 8751 9090 9116 9203 9243 10529 10550 12013 12059 13857 13891 14952 14978 15892 15904 16431 16471 16992 17037 17217 17252 18012 18025 18835 18857 19069 19098 19304 19335 19368 19395 19742 19785 21043 21088 22572 2260...
output:
0
result:
wrong answer 1st lines differ - expected: '481592148304036', found: '0'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 364ms
memory: 519828kb
input:
5000 2000000 0 333 376 1484 1485 1602 1625 1751 1751 3230 3264 3473 3522 5932 5942 6782 6813 6830 6863 6982 7007 7013 7034 7226 7259 8555 8585 8652 8668 9354 9389 9440 9486 9942 9963 12552 12599 13153 13174 14096 14139 14895 14903 17478 17490 18195 18227 18907 18941 19183 19214 19635 19670 19984 200...
output:
0
result:
wrong answer 1st lines differ - expected: '386702830511273236', found: '0'
Subtask #3:
score: 20
Accepted
Test #17:
score: 20
Accepted
time: 293ms
memory: 519592kb
input:
5000 2000000 1 53 53 54 54 1775 1775 1776 1776 2217 2217 2312 2312 4982 4982 5212 5212 5213 5213 5214 5214 6199 6199 8528 8528 10141 10141 10142 10142 10719 10719 10720 10720 10721 10721 11868 11868 12311 12311 12312 12312 12313 12313 16789 16789 18899 18899 18900 18900 22515 22515 22516 22516 25061...
output:
9396621550536124
result:
ok single line: '9396621550536124'
Test #18:
score: 20
Accepted
time: 210ms
memory: 490980kb
input:
5000 2000000 1 607 607 608 608 1117 1117 1118 1118 1119 1119 1120 1120 2963 2963 2964 2964 2965 2965 3269 3269 3270 3270 3271 3271 3272 3272 3690 3690 5126 5126 5127 5127 5128 5128 5357 5357 5358 5358 5359 5359 5676 5676 5677 5677 5678 5678 5679 5679 5799 5799 7141 7141 7142 7142 7143 7143 7144 7144...
output:
3924758937980887
result:
ok single line: '3924758937980887'
Test #19:
score: 20
Accepted
time: 162ms
memory: 489572kb
input:
5000 2000000 1 1146 1146 1147 1147 1148 1148 1149 1149 1150 1150 1151 1151 1152 1152 1153 1153 1154 1154 1155 1155 1156 1156 1368 1368 1369 1369 1370 1370 1371 1371 1372 1372 1373 1373 1374 1374 1375 1375 1376 1376 1377 1377 3023 3023 3024 3024 3025 3025 3026 3026 7294 7294 7295 7295 7296 7296 7297 ...
output:
3498950038337569
result:
ok single line: '3498950038337569'
Test #20:
score: 20
Accepted
time: 171ms
memory: 491368kb
input:
5000 2000000 1 207 207 208 208 209 209 210 210 211 211 212 212 213 213 214 214 215 215 216 216 217 217 218 218 219 219 220 220 221 221 1497 1497 1498 1498 1499 1499 2546 2546 2547 2547 2548 2548 2549 2549 2550 2550 2551 2551 2552 2552 2553 2553 2554 2554 2555 2555 2556 2556 2557 2557 2558 2558 3491 ...
output:
3361440413095543
result:
ok single line: '3361440413095543'
Test #21:
score: 20
Accepted
time: 229ms
memory: 500756kb
input:
5000 2000000 1 6166 6166 6167 6167 6168 6168 6169 6169 6170 6170 6171 6171 6172 6172 6189 6189 6505 6505 6506 6506 6507 6507 6508 6508 13543 13543 13544 13544 13545 13545 13546 13546 13547 13547 13548 13548 13549 13549 13550 13550 16246 16246 16247 16247 16248 16248 16249 16249 18920 18920 18921 189...
output:
6515086919470194
result:
ok single line: '6515086919470194'
Test #22:
score: 20
Accepted
time: 203ms
memory: 498996kb
input:
5000 2000000 1 50157 50157 50158 50158 50159 50159 50160 50160 50161 50161 50162 50162 50163 50163 50164 50164 50165 50165 50166 50166 50167 50167 50168 50168 50169 50169 50170 50170 50171 50171 50172 50172 50173 50173 50174 50174 50175 50175 50176 50176 50177 50177 50178 50178 50179 50179 50180 501...
output:
16846380168054
result:
ok single line: '16846380168054'
Test #23:
score: 20
Accepted
time: 161ms
memory: 489792kb
input:
5000 2000000 1 1571 1571 1572 1572 1573 1573 1574 1574 1575 1575 1576 1576 1577 1577 1578 1578 1579 1579 1580 1580 1581 1581 1582 1582 1583 1583 1584 1584 1585 1585 1586 1586 1587 1587 1588 1588 1589 1589 1590 1590 1591 1591 1592 1592 1593 1593 1594 1594 1595 1595 1596 1596 1597 1597 1598 1598 1599 ...
output:
758710189026162
result:
ok single line: '758710189026162'
Test #24:
score: 20
Accepted
time: 151ms
memory: 490716kb
input:
5000 2000000 1 3287 3287 3288 3288 3289 3289 3290 3290 3291 3291 3292 3292 3293 3293 3294 3294 3295 3295 3296 3296 3297 3297 3298 3298 3299 3299 3300 3300 3301 3301 3302 3302 3303 3303 3304 3304 3305 3305 3306 3306 3307 3307 3308 3308 3309 3309 3310 3310 3311 3311 3312 3312 3313 3313 3314 3314 3315 ...
output:
1870212953908404
result:
ok single line: '1870212953908404'
Subtask #4:
score: 0
Skipped
Dependency #1:
0%