QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#832924 | #9240. Mosaic | syxsyx# | 12 | 72ms | 35576kb | C++20 | 2.6kb | 2024-12-26 11:05:35 | 2024-12-26 11:05:36 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=400005;
int n,q;
int a[N],b[N],val[N];
long long sum[N],sum2[N];
int tag[N],sumtag[N];
//tag:cnt of added "000"->"010"
int qu[N],qd[N],ql[N],qr[N];
long long ans[N];
void work0()
{
for(int i=1;i<=n;i++) val[i]=b[i];
for(int i=1;i<=n;i++) sum[i]=sum[i-1]+val[i];
for(int i=1;i<=q;i++) if(ql[i]==1) ans[i]+=sum[qd[i]]-sum[qu[i]-1],ql[i]++;
// for(int i=1;i<=n;i++) printf("%d ",val[i]);printf("\n");
val[1]=a[2];
for(int i=2;i<=n;i++) val[i]=(val[i-1]^1)&(val[i]^1);
for(int i=1;i<=n;i++) sum[i]=sum[i-1]+val[i];
for(int i=1;i<=q;i++) if(ql[i]==2&&qr[i]>=2) ans[i]+=sum[qd[i]]-sum[qu[i]-1],ql[i]++;
// for(int i=1;i<=n;i++) printf("%d ",val[i]);printf("\n");
for(int i=1;i<=n;i++) val[i]=a[i];
for(int i=1;i<=n;i++) sum[i]=sum[i-1]+val[i];
for(int i=1;i<=q;i++) if(qu[i]==1) ans[i]+=sum[qr[i]]-sum[ql[i]-1],qu[i]++;
// for(int i=1;i<=n;i++) printf("%d ",val[i]);printf("\n");
val[1]=b[2];
for(int i=2;i<=n;i++) val[i]=(val[i-1]^1)&(val[i]^1);
for(int i=1;i<=n;i++) sum[i]=sum[i-1]+val[i];
for(int i=1;i<=q;i++) if(qu[i]==2&&qd[i]>=2) ans[i]+=sum[qr[i]]-sum[ql[i]-1],qu[i]++;
// for(int i=1;i<=n;i++) printf("%d ",val[i]);printf("\n");
val[1]=b[3];
for(int i=2;i<=n;i++) val[i]=(val[i-1]^1)&(val[i]^1);
}
void work1()
{
int now=n-3;
for(int i=n;i>=1;i--) val[now+i]=val[i];
for(int i=4;i<=n;i++)
{
int x=now-i+4;
val[x]=b[i];
if(val[x]==0&&val[x+1]==0&&b[i+1]==0&&i!=n) val[x]=1;
}
for(int i=1;i<=now+n;i++) sum[i]=sum[i-1]+val[i];
for(int i=1;i<=now+n;i++) sum2[i]=sum2[i-1]+sum[i];
// for(int i=1;i<=now+n;i++) printf("%d ",val[i]);printf("\n");
// for(int i=1;i<=now+n;i++) printf("%lld ",sum[i]);printf("\n");
// for(int i=1;i<=now+n;i++) printf("%lld ",sum2[i]);printf("\n");
for(int i=1;i<=q;i++)
{
if(qu[i]>qd[i]||ql[i]>qr[i]) continue;
int l=ql[i]-(qu[i]-2)+1+now,r=qr[i]-(qu[i]-2)+1+now;
int len=qd[i]-qu[i]+1;
// printf("%d:%d %d %d::",i,l,r,len);
// printf("%lld ",ans[i]);
ans[i]+=sum2[r]-sum2[l-1]-sum2[r-len]+sum2[l-1-len];
// printf("%lld\n",ans[i]);
}
}
vector <long long> mosaic(vector <int> X,vector <int> Y,vector <int> T,vector <int> B,vector <int> L,vector <int> R)
{
n=X.size();
for(int i=0;i<n;i++) a[i+1]=X[i],b[i+1]=Y[i];
q=T.size();
for(int i=0;i<q;i++) qu[i+1]=T[i]+1,qd[i+1]=B[i]+1,ql[i+1]=L[i]+1,qr[i+1]=R[i]+1;
work0();
work1();
vector <long long> ret;
for(int i=1;i<=q;i++) ret.push_back(ans[i]);
return ret;
}
/*
4
1 0 1 0
1 1 0 1
2
0 3 0 3
2 3 0 2
7
3
5
0 1 1 1 1
0 0 0 0 0
2
1 4 0 4
0 4 0 3
*/
详细
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 2ms
memory: 14356kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 1 0 0 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 0 0 0 0 0 0 0 0 0 0
result:
ok
Test #2:
score: 5
Accepted
time: 0ms
memory: 16164kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 1 1 1 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1 1 1 1 1 1 1 1 1 1
result:
ok
Test #3:
score: 5
Accepted
time: 2ms
memory: 14020kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 0 1 0 10 1 1 0 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 0 1 0 1 1 1 1 1 0 1 0 0 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1 1 1 2 2 0 2 1 1 1
result:
ok
Test #4:
score: 5
Accepted
time: 1ms
memory: 14112kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 0 1 0 10 0 1 1 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 0 1 0 1 0 0 1 1 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1 2 1 1 2 1 1 1 1 0
result:
ok
Test #5:
score: 5
Accepted
time: 0ms
memory: 14060kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 0 1 0 0 10 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 0 1 0 0 0 0 1 1 1 1
result:
ok
Test #6:
score: 5
Accepted
time: 2ms
memory: 16104kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 1 1 0 10 0 0 0 1 0 0 0 1 1 1 0 1 0 1 0 1 0 1 0 0 0 1 1 1 1 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 2 2 0 2 1 1 0 1 1 1
result:
ok
Test #7:
score: 5
Accepted
time: 2ms
memory: 14060kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 0 0 0 1 10 0 0 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 0 1 1 0 0 0 1 0 1 0 0 1 1 0 1 1 1 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 0 1 1 1 0 0 0 1 1 1
result:
ok
Test #8:
score: 5
Accepted
time: 0ms
memory: 16100kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 0 1 1 10 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 1 1 0 1 0 1 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 2 1 1 0 1 0 2 0 1 2
result:
ok
Test #9:
score: 5
Accepted
time: 1ms
memory: 16364kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 0 1 0 1 10 0 1 0 1 0 1 0 1 1 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 2 2 0 2 1 2 1 0 1 2
result:
ok
Test #10:
score: 5
Accepted
time: 1ms
memory: 14112kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 2 1 1 1 1 10 0 0 0 1 0 1 0 0 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 1 1 1
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 2 2 2 3 1 3 3 1 3 0
result:
ok
Subtask #2:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #11:
score: 0
Wrong Answer
time: 2ms
memory: 16064kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199 0 0 1 0 0 1 0 0 0 1 0 0 1 1 1 0 1 0 1 1 1 1 0 1 0 1 1 1 0 0 1 1 0 1 1 0 0 1 1 0 1 0 1 1 0 1 0 0 1 0 1 0 1 1 1 1 0 0 1 1 1 1 0 1 1 0 0 1 0 1 1 1 1 1 1 0 0 0 1 0 0 1 0 0 0 0 0 1 0 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 0 1 1 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 0 0 0 1...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1078 5183 1059 464 12135 1940 2344 5372 1009 2091 34 430 821 6472 5408 625 44 15 316 423 4389 135 5793 49 1664 1674 117 1585 1356 6845 5909 2680 77 3146 1457 81 5007 3117 327 3351 432 2206 670 1643 1050 6772 2380 2399 363 4304 2518 5072 934 1812 2827 1915 75 11548...
result:
wrong answer 4th lines differ - on the 1st token, expected: '5062', found: '5183'
Subtask #3:
score: 7
Accepted
Test #18:
score: 7
Accepted
time: 69ms
memory: 34052kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199999 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 1 1 0 1 0 0 1 1 0 1 1 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 0 0 0 1 0 0 0 0 1 0 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 0 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 1314 79312 13238 63518 27135 86532 21129 53105 14461 13920 65981 66950 13385 23885 37091 56646 69855 64947 74166 41759 50738 1366 65318 58452 24337 58380 29379 59258 39016 4990 60529 23351 60370 12835 25686 8151 17007 56172 10913 7224 30221 73673 55593 33643 44070...
result:
ok
Test #19:
score: 7
Accepted
time: 59ms
memory: 34644kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199999 0 1 1 0 0 1 1 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 0 0 1 1 1 1 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 0 0 0 1 1 0 0 1 0 1 0 1 0 0 1 1 1 1 1 1 1 0 1 1 0 0 1 1 1 1 0 0 1 1 0 1 1 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 97288 84412 98958 98546 95894 91536 99791 94852 96879 98784 94005 99030 95916 90829 96593 96545 90518 95251 93882 95122 94925 96009 98788 98866 95996 97263 95422 95733 96576 97730 98106 96939 94030 94576 94019 92982 96921 95715 96639 93579 97372 97983 95123 95211 ...
result:
ok
Test #20:
score: 7
Accepted
time: 59ms
memory: 34592kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 200000 1 0 0 1 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 0 1 0 1 1 1 1 0 1 0 1 1 0 1 1 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 0 0 1 0 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 63186 59869 80378 71302 94439 63006 84372 99459 21243 54879 86436 65742 94261 35276 55849 93734 72881 49090 34951 93280 90257 58145 84070 58055 95069 56733 82475 51301 59357 39555 95572 87255 37523 68017 80309 52815 95469 29140 85700 46052 56013 71305 90947 7434 6...
result:
ok
Test #21:
score: 7
Accepted
time: 66ms
memory: 35576kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 200000 1 0 0 0 1 1 0 1 0 1 1 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 1 0 1 0 1 0 1 1 1 0 0 1 1 1 1 1 1 0 1 1 0 1 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 0 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 0 0 1 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 1 1 1 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 99156 96398 98499 93058 98359 93547 93120 98997 99065 97926 99050 95046 96687 98137 97249 97530 96983 98126 89892 94397 98111 96471 95754 99320 97511 95029 96780 93937 97095 97566 97024 99338 97729 99722 97152 98216 95895 97942 98980 99845 96992 97397 99255 97894 ...
result:
ok
Test #22:
score: 7
Accepted
time: 52ms
memory: 32388kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 100000 0 0 1 1 0 1 1 0 0 0 0 1 1 0 0 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0 1 1 0 1 1 1 1 1 0 1 0 1 0 1 0 0 1 0 1 1 0 1 0 1 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 1 0 1 1 1 0 1 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 1 0 1 1 0 1 1 1 0 1 0 1 1 1 0 1 1 0 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 34862 31357 15637 16893 7670 123 17919 20936 7467 18723 34082 1835 18668 23866 630 26206 40304 6217 25617 18490 11507 39163 5570 16345 4695 30449 15992 13307 5315 5393 8864 29876 34139 3227 28910 11628 2250 38538 12586 299 1066 8238 40627 7418 7600 3123 18111 9012...
result:
ok
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Wrong Answer
Test #31:
score: 0
Wrong Answer
time: 36ms
memory: 26536kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 10 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 200000 1 7 0 4 3 4 3 4 3 6 2 5 4 5 6 7 5 7 2 8 0 6 4 7 0 5 6 7 1 3 9 9 6 9 1 7 2 9 4 6 4 4 6 7 0 1 8 8 7 7 0 3 0 4 1 7 2 2 0 9 3 9 4 6 3 9 0 9 1 8 4 6 4 5 5 7 0 6 2 3 2 3 0 6 1 9 8 8 2 4 3 4 3 6 2 9 3 9 2 7 1 3 0 3 0 8 2 4 3...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 13 2 6 2 9 11 5 2 12 11 1 0 2 13 4 9 29 10 3 5 6 4 3 14 18 5 10 5 7 9 11 3 6 3 5 13 6 3 5 8 14 21 2 4 9 6 14 3 4 11 4 8 21 1 2 4 6 4 1 3 3 3 4 4 16 29 9 1 7 7 4 11 11 7 4 4 8 4 4 14 7 12 7 2 2 7 18 1 2 2 5 13 19 14 7 1 3 2 3 15 19 6 2 5 3 12 14 8 33 6 6 7 8 8 13 5...
result:
wrong answer 3rd lines differ - on the 1st token, expected: '14', found: '13'
Subtask #6:
score: 0
Wrong Answer
Test #42:
score: 0
Wrong Answer
time: 72ms
memory: 35036kb
input:
njJ9Z7VxxKGR6SUcJMgdzy3qMz4JZ1Tq 199999 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 0 1 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1 ...
output:
Wm5rkGNobnYjFI7TIY17RAm6FAQ2LlO9 OK 0 1 0 1 0 1 0 0 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 0 0 0 1 0 1 1 0 1 0 1 1 1 1 1 0 1 0 0 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 0 0 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 0 0 1 1 0 0 0 0 1 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 0 0 1 0 0 0 0 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 ...
result:
wrong answer 15th lines differ - on the 1st token, expected: '0', found: '1'
Subtask #7:
score: 0
Skipped
Dependency #3:
100%
Accepted
Dependency #6:
0%
Subtask #8:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%