QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#354321 | #8221. 多方计算 | xyz123 | 18 | 150ms | 53084kb | C++14 | 3.7kb | 2024-03-15 08:57:04 | 2024-03-15 08:57:05 |
Judging History
answer
#include<bits/stdc++.h>
#include "mpc.h"
using namespace std;
const int N=22000,M=2200;
long long a,b,dp[2001][2001],f[2001],y[2001],L[2001],lm=5;
int precalc(int n, int m)
{
a=n,b=m;
long long tt=1,gg=0;
while(tt<=n) tt*=2,++gg;
lm=gg;
gg=ceil(log2(lm));
int hh=lm,uu=1;
while(hh<a)
{
long long yy=0;
for(int i=hh;i<hh+uu&&i<a;i++) L[i]=b-uu-yy,++yy;//cout<<i<<" "<<L[i]<<"\n";
hh+=uu;uu*=2;
}
return n+m+gg;
}
bool transmit(player &player, int round, int position)
{
int tt=player.last_message;
int g1=round-position-1;
int nw=position;
if(g1>=0)
{
// if(nw>lm) cout<<L[nw-1]+round-2<<"\n";
player.memory[g1]+=tt;
for(int i=g1;i<=M;i++)
{
if(player.memory[i]>1)
{
player.memory[i]-=2;
player.memory[i+1]++;
}
else break;
}
}
else if(nw>lm&&L[nw-1]+round-2>=0)
{
int g2=L[nw-1]+round-2;
player.memory[g2]+=tt;
for(int i=g2;i<=M;i++)
{
if(player.memory[i]>1)
{
player.memory[i]-=2;
player.memory[i+1]++;
}
else break;
}
}
if(g1<0)
{
if(nw<lm) return 0;
if(L[nw]+round-1<0) return 0;
int gg=player.memory[L[nw]+round-1];
// cout<<round<<" "<<nw<<" "<<L[nw]+round-1<<" "<<gg<<"\n";
if(nw!=a) player.memory[L[nw]+round-1]=0;
return gg;
}
// cout<<L[nw]+round-1<<"\n";
return player.memory[g1];
}
//namespace grader{
// int score[10]={100,13,11,8,5,5,4,4,3,3};
// std::mt19937_64 rnd(time(0));
// struct bigint{
// int val[M];
// void clear(){
// memset(val,0,sizeof(val));
// }
// void gen(int len){
// for(int i=0;i<len;i++)val[i]=rnd()%2;
// }
// void read(int len){
// for(int i=0;i<len;i++)std::cin>>val[i];
// }
// void print(int len){
// for(int i=0;i<len;i++)printf("%d",val[i]);
// printf("\n");
// }
// }num[N],correct_result;
// bigint plus(bigint x, bigint y){
// int carry=0;
// bigint ans;ans.clear();
// for(int i=0;i<M;i++){
// ans.val[i]=(x.val[i]+y.val[i]+carry)%2;
// carry=(x.val[i]+y.val[i]+carry)/2;
// }
// return ans;
// }
// int n,m,ans;
// ::player player[N];
// void gen_data(int n,int m){
// for(int i=0;i<n;i++)num[i].read(m);
// correct_result.clear();
// for(int i=0;i<n;i++)correct_result=plus(correct_result,num[i]);
// }
// void grade(){
// std::cin>>n>>m;
// ans=precalc(n,m);
// gen_data(n,m);
// for(int i=0;i<n;i++){
// player[i].memory.fill(0);
// for(int j=0;j<M;j++)player[i].memory[j]=num[i].val[j];
// }
// for(int i=1;i<=ans;i++){
// for(int j=n;j>=0;j--){
// bool curr=transmit(player[j],i,j);
// if(j<n)player[j+1].last_message=curr;
//// cout<<curr;
// }//cout<<"\n";
//// for(int j=0;j<=n;j++)
//// {
//// for(int k=0;k<m+4;k++) cout<<player[j].memory[k];cout<<"\n";
//// }cout<<"\n";
// }
// bool correct=1;
// correct_result.print(M);
// for(int i=0;i<M;i++)correct&=(player[n].memory[i]==correct_result.val[i]);
// for(int i=0;i<M;i++)printf("%d",player[n].memory[i]);puts("");
// if(!correct){
// printf("Your answer is not correct.");
// }
// else{
// int score_=0;
// for(int i=0;i<=9;i++)if(n+m+score[i]>=ans)score_++;
// printf("OK, you get %d%% points",score_*10);
// }
// }
//}
//
//int main(){
// std::ios::sync_with_stdio(0);std::cin.tie(0);
// grader::grade();
// return 0;
//}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 10
Accepted
Test #1:
score: 10
Accepted
time: 1ms
memory: 4072kb
input:
5 5 3185997250635081508 10243950506680270049
output:
4123764187658
result:
ok Perfect. 10
Test #2:
score: 10
Accepted
time: 1ms
memory: 4072kb
input:
5 5 3552483843587513799 14478819593833617714
output:
4123764187658
result:
ok Perfect. 10
Test #3:
score: 10
Accepted
time: 1ms
memory: 4112kb
input:
5 5 1049434279474537131 1049728252928449771
output:
4123764187658
result:
ok Perfect. 10
Test #4:
score: 10
Accepted
time: 1ms
memory: 4116kb
input:
5 5 8922384302424007645 1173548755077470934
output:
4123764187658
result:
ok Perfect. 10
Test #5:
score: 10
Accepted
time: 1ms
memory: 4096kb
input:
5 5 10436985171519237349 6372260076854600203
output:
4123764187658
result:
ok Perfect. 10
Test #6:
score: 10
Accepted
time: 1ms
memory: 4028kb
input:
5 5 3969271731891539589 872380446563047377
output:
4123764187658
result:
ok Perfect. 10
Test #7:
score: 10
Accepted
time: 0ms
memory: 4012kb
input:
5 5 10791248432551339097 10907238234860663613
output:
4123764187658
result:
ok Perfect. 10
Test #8:
score: 10
Accepted
time: 1ms
memory: 4040kb
input:
5 5 4133452284370185751 8351536681439074389
output:
4123764187658
result:
ok Perfect. 10
Test #9:
score: 10
Accepted
time: 1ms
memory: 3964kb
input:
5 5 4588466072500947787 2668799652971323944
output:
4123764187658
result:
ok Perfect. 10
Test #10:
score: 10
Accepted
time: 1ms
memory: 4200kb
input:
5 5 14152525429264304911 13775135703660625045
output:
4123764187658
result:
ok Perfect. 10
Test #11:
score: 10
Accepted
time: 1ms
memory: 4104kb
input:
5 5 7421526808561975748 10544499515413224856
output:
4123764187658
result:
ok Perfect. 10
Test #12:
score: 10
Accepted
time: 1ms
memory: 4104kb
input:
5 5 10533068226990172617 16920379813521486362
output:
4123764187658
result:
ok Perfect. 10
Test #13:
score: 10
Accepted
time: 0ms
memory: 4016kb
input:
5 5 12984923981069466020 10402168891728084823
output:
4123764187658
result:
ok Perfect. 10
Test #14:
score: 10
Accepted
time: 1ms
memory: 4200kb
input:
5 5 4547699393608837176 17811338561394180193
output:
4123764187658
result:
ok Perfect. 10
Test #15:
score: 10
Accepted
time: 1ms
memory: 4036kb
input:
5 5 7797814030854767695 12994778421940209897
output:
4123764187658
result:
ok Perfect. 10
Test #16:
score: 10
Accepted
time: 1ms
memory: 4020kb
input:
5 5 13586090146748389854 8573353291555348877
output:
4123764187658
result:
ok Perfect. 10
Test #17:
score: 10
Accepted
time: 1ms
memory: 4076kb
input:
5 5 7492677468637862337 17412579963708759713
output:
4123764187658
result:
ok Perfect. 10
Test #18:
score: 10
Accepted
time: 1ms
memory: 4176kb
input:
5 5 12538610689378370624 10934031436815865430
output:
4123764187658
result:
ok Perfect. 10
Test #19:
score: 10
Accepted
time: 1ms
memory: 4096kb
input:
5 5 6318529188948278594 4765084946625953274
output:
4123764187658
result:
ok Perfect. 10
Test #20:
score: 10
Accepted
time: 1ms
memory: 4108kb
input:
5 5 12764462787770553234 16031550997283183642
output:
4123764187658
result:
ok Perfect. 10
Test #21:
score: 10
Accepted
time: 1ms
memory: 4016kb
input:
5 5 16850625473722229566 12858849229956583645
output:
4123764187658
result:
ok Perfect. 10
Test #22:
score: 10
Accepted
time: 0ms
memory: 4076kb
input:
5 5 3916752702561709368 14568996895902750709
output:
4123764187658
result:
ok Perfect. 10
Test #23:
score: 10
Accepted
time: 0ms
memory: 4072kb
input:
5 5 2793964619809963444 14799430123914266097
output:
4123764187658
result:
ok Perfect. 10
Test #24:
score: 10
Accepted
time: 1ms
memory: 4100kb
input:
5 5 14022384786197322639 15644367891444293842
output:
4123764187658
result:
ok Perfect. 10
Test #25:
score: 10
Accepted
time: 1ms
memory: 4176kb
input:
5 5 4677661251438971503 7860382546781589019
output:
4123764187658
result:
ok Perfect. 10
Test #26:
score: 10
Accepted
time: 1ms
memory: 4072kb
input:
5 5 865745884266339793 3234925754863119957
output:
4123764187658
result:
ok Perfect. 10
Test #27:
score: 10
Accepted
time: 1ms
memory: 4068kb
input:
5 5 16601073251043052245 5101181031338699631
output:
4123764187658
result:
ok Perfect. 10
Test #28:
score: 10
Accepted
time: 1ms
memory: 4168kb
input:
5 5 4666335567338264413 17869704479146009894
output:
4123764187658
result:
ok Perfect. 10
Test #29:
score: 10
Accepted
time: 1ms
memory: 4020kb
input:
5 5 10276076269669835904 6933906736047769186
output:
4123764187658
result:
ok Perfect. 10
Test #30:
score: 10
Accepted
time: 1ms
memory: 4144kb
input:
5 5 3547072148765339907 5805660413096765891
output:
4123764187658
result:
ok Perfect. 10
Test #31:
score: 10
Accepted
time: 1ms
memory: 4032kb
input:
5 5 5905632931049428772 15089509813347254316
output:
4123764187658
result:
ok Perfect. 10
Test #32:
score: 10
Accepted
time: 0ms
memory: 4016kb
input:
5 5 6148686139569402051 6521476089554108987
output:
4123764187658
result:
ok Perfect. 10
Test #33:
score: 10
Accepted
time: 1ms
memory: 4104kb
input:
5 5 10293582518274215475 2676706070504789810
output:
4123764187658
result:
ok Perfect. 10
Test #34:
score: 10
Accepted
time: 1ms
memory: 4072kb
input:
5 5 6589510135221577212 2537901023039331965
output:
4123764187658
result:
ok Perfect. 10
Test #35:
score: 10
Accepted
time: 1ms
memory: 4036kb
input:
5 5 5329171491039567345 943883204937169735
output:
4123764187658
result:
ok Perfect. 10
Test #36:
score: 10
Accepted
time: 1ms
memory: 4112kb
input:
5 5 18153714120372683774 16958100625183201027
output:
4123764187658
result:
ok Perfect. 10
Subtask #2:
score: 8
Acceptable Answer
Test #37:
score: 8
Acceptable Answer
time: 10ms
memory: 24112kb
input:
1000 1 17833636513278974999 18032835279213373306
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #38:
score: 8
Acceptable Answer
time: 12ms
memory: 24080kb
input:
1000 1 14730911653810224758 12266600726496100996
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #39:
score: 8
Acceptable Answer
time: 10ms
memory: 23936kb
input:
1000 1 8799733959292548924 5387063902427699037
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #40:
score: 8
Acceptable Answer
time: 17ms
memory: 23876kb
input:
1000 1 9630334707439747607 4291049102998855878
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #41:
score: 8
Acceptable Answer
time: 13ms
memory: 24012kb
input:
1000 1 14659313773847015835 5872125537220100813
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #42:
score: 8
Acceptable Answer
time: 12ms
memory: 23992kb
input:
1000 1 8843810642295111463 9289549733703682079
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #43:
score: 8
Acceptable Answer
time: 8ms
memory: 24080kb
input:
1000 1 12506531245496737504 16568422609970603828
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #44:
score: 8
Acceptable Answer
time: 17ms
memory: 24016kb
input:
1000 1 1687678405863133532 5008244365647721871
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #45:
score: 8
Acceptable Answer
time: 14ms
memory: 24060kb
input:
1000 1 521330378415348792 8325284866479671525
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #46:
score: 8
Acceptable Answer
time: 17ms
memory: 23944kb
input:
1000 1 6611871207626880018 9817110237545272117
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #47:
score: 8
Acceptable Answer
time: 13ms
memory: 25912kb
input:
1000 1 15306541734406271267 14703264691591359191
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #48:
score: 8
Acceptable Answer
time: 8ms
memory: 23988kb
input:
1000 1 3566881709297895710 7594566018112860837
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #49:
score: 8
Acceptable Answer
time: 18ms
memory: 24008kb
input:
1000 1 4397454027521899216 7721560744364225236
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #50:
score: 8
Acceptable Answer
time: 16ms
memory: 23988kb
input:
1000 1 5142075432412851988 16742257564666708908
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #51:
score: 8
Acceptable Answer
time: 7ms
memory: 25972kb
input:
1000 1 12044326647208924489 2167359237561753365
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #52:
score: 8
Acceptable Answer
time: 12ms
memory: 26012kb
input:
1000 1 16253907834346424870 11108645373354737991
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #53:
score: 8
Acceptable Answer
time: 7ms
memory: 26008kb
input:
1000 1 16626499607125776891 8356934117282130057
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #54:
score: 8
Acceptable Answer
time: 8ms
memory: 26028kb
input:
1000 1 3282168031615086167 3657599301669157549
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #55:
score: 8
Acceptable Answer
time: 8ms
memory: 25908kb
input:
1000 1 14215560210789593083 15626251936339749845
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #56:
score: 8
Acceptable Answer
time: 12ms
memory: 26044kb
input:
1000 1 2190592376641362424 13403200408316995773
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #57:
score: 8
Acceptable Answer
time: 14ms
memory: 26120kb
input:
1000 1 11465558394225010724 2496884116655812179
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #58:
score: 8
Acceptable Answer
time: 7ms
memory: 26148kb
input:
1000 1 18276809344802529187 9561628486185706823
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #59:
score: 8
Acceptable Answer
time: 13ms
memory: 26124kb
input:
1000 1 7860122780923461882 10042766163912380121
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #60:
score: 8
Acceptable Answer
time: 7ms
memory: 26024kb
input:
1000 1 12388686810101047811 3399743554629441239
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #61:
score: 8
Acceptable Answer
time: 13ms
memory: 26016kb
input:
1000 1 14427576709382087754 13171985723510234618
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #62:
score: 8
Acceptable Answer
time: 14ms
memory: 26124kb
input:
1000 1 7668903319567597796 8075077151477112929
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #63:
score: 8
Acceptable Answer
time: 11ms
memory: 25868kb
input:
1000 1 14122766694312513270 6279188681168230824
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #64:
score: 8
Acceptable Answer
time: 17ms
memory: 26028kb
input:
1000 1 5699987051542490697 8384784519684171122
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #65:
score: 8
Acceptable Answer
time: 10ms
memory: 26020kb
input:
1000 1 11830949407183123854 9439666782273874030
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #66:
score: 8
Acceptable Answer
time: 17ms
memory: 26016kb
input:
1000 1 9554889270917528521 11260732977199304707
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #67:
score: 8
Acceptable Answer
time: 10ms
memory: 26064kb
input:
1000 1 17459479638232299425 11063210786482562440
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #68:
score: 8
Acceptable Answer
time: 17ms
memory: 26052kb
input:
1000 1 15086329177686012536 8242831546145677467
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #69:
score: 8
Acceptable Answer
time: 7ms
memory: 26024kb
input:
1000 1 15745267644798804685 16686857765674424216
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #70:
score: 8
Acceptable Answer
time: 8ms
memory: 25980kb
input:
1000 1 9660862519797395098 1310528139508248324
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #71:
score: 8
Acceptable Answer
time: 13ms
memory: 26024kb
input:
1000 1 3951648867737539370 17836842425696853386
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #72:
score: 8
Acceptable Answer
time: 7ms
memory: 26020kb
input:
1000 1 3683735297104135564 13137254066150313412
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Subtask #3:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 17ms
memory: 26128kb
input:
1000 10 7581650225429700886 16046788410942473709
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #4:
score: 0
Wrong Answer
Test #109:
score: 8
Acceptable Answer
time: 10ms
memory: 26140kb
input:
1000 30 15510757929061591914 2629686482095382587
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #110:
score: 0
Wrong Answer
time: 8ms
memory: 26092kb
input:
1000 30 12801036214420587075 2037510991448894723
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #5:
score: 0
Wrong Answer
Test #145:
score: 0
Wrong Answer
time: 1ms
memory: 6096kb
input:
3 1000 341353812123787886 3685575517089631424
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #6:
score: 0
Wrong Answer
Test #181:
score: 10
Accepted
time: 0ms
memory: 4160kb
input:
10 1000 18326939717248212778 15447461170187547045
output:
4123764187658
result:
ok Perfect. 10
Test #182:
score: 0
Wrong Answer
time: 1ms
memory: 4208kb
input:
10 1000 14303031343316484183 9472080590628751829
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #7:
score: 0
Wrong Answer
Test #217:
score: 8
Acceptable Answer
time: 8ms
memory: 15920kb
input:
500 1000 3911210051670624968 2787181900148297327
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #218:
score: 0
Wrong Answer
time: 13ms
memory: 15948kb
input:
500 1000 12450618735493522488 12992043229059408722
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #8:
score: 0
Wrong Answer
Test #253:
score: 0
Wrong Answer
time: 23ms
memory: 27860kb
input:
1000 1000 2442055921391744378 15448328346037637846
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #9:
score: 0
Wrong Answer
Test #289:
score: 8
Acceptable Answer
time: 75ms
memory: 40884kb
input:
1500 1500 8660688640427922501 1436138393991664715
output:
4123764187656
result:
points 0.80 Correct Answer. 8
Test #290:
score: 0
Wrong Answer
time: 79ms
memory: 40960kb
input:
1500 1500 15821468721449590935 1370287063033011416
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #10:
score: 0
Wrong Answer
Test #325:
score: 0
Wrong Answer
time: 150ms
memory: 53084kb
input:
2000 2000 6596342253746377097 6195418207254921855
output:
4123764187648
result:
points 0.0 Correct Answer. 0