QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#340639 | #8221. 多方计算 | hos_lyric | 20 | 99ms | 57456kb | C++14 | 1.7kb | 2024-02-29 10:53:42 | 2024-02-29 10:53:42 |
Judging History
answer
#include "mpc.h"
int precalc(int n,int m){
return n + m + 3;
}
bool transmit(player &player, int round,int position){
constexpr int M = 2200;
const int msg = player.last_message;
auto A = [&](int i) -> int & {
return player.memory[i];
};
// waiting to be sent, base 2^J
constexpr int J = 30;
auto wait = [&](int i) -> int & {
return A(M + i);
};
if (round == 1) {
for (int e = 0; e < M; ++e) if (A(e)) {
wait(e/J) |= 1 << (e%J);
}
}
auto receive = [&](int e) -> void {
A(e) += 1;
for (int f = e; A(f) >= 2; ++f) {
A(f) -= 2;
A(f + 1) += 1;
}
wait(e/J) += 1 << (e%J);
for (int i = e/J; wait(i) >= 1 << J; ++i) {
wait(i) -= 1 << J;
wait(i + 1) += 1;
}
};
auto send = [&](int e) -> int {
if (wait(e/J) & 1 << (e%J)) {
wait(e/J) ^= 1 << (e%J);
return 1;
} else {
return 0;
}
};
const int d = round - position - 1;
if (d >= 0) {
if (msg) {
receive(d);
}
return send(d);
} else {
// send highest every L rounds
constexpr int L = 12;
const int phase = (round - 1) % L;
int &posRec = A(4095);
int &posSen = A(4094);
if (phase == 0) {
if (msg) {
receive(posRec);
}
posRec = 0;
posSen = -1;
for (int i = (M-1)/J; i >= 0; --i) if (wait(i)) {
posSen = i * J + (31 - __builtin_clz(wait(i)));
break;
}
} else {
if (msg) {
posRec |= 1 << (phase - 1);
}
}
if (~posSen) {
if (phase < L - 1) {
return posSen >> phase & 1;
} else {
return send(posSen);
}
} else {
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: 5948kb
input:
5 5 3185997250635081508 10243950506680270049
output:
4123764187658
result:
ok Perfect. 10
Test #2:
score: 10
Accepted
time: 1ms
memory: 5968kb
input:
5 5 3552483843587513799 14478819593833617714
output:
4123764187658
result:
ok Perfect. 10
Test #3:
score: 10
Accepted
time: 1ms
memory: 6032kb
input:
5 5 1049434279474537131 1049728252928449771
output:
4123764187658
result:
ok Perfect. 10
Test #4:
score: 10
Accepted
time: 1ms
memory: 6044kb
input:
5 5 8922384302424007645 1173548755077470934
output:
4123764187658
result:
ok Perfect. 10
Test #5:
score: 10
Accepted
time: 1ms
memory: 8020kb
input:
5 5 10436985171519237349 6372260076854600203
output:
4123764187658
result:
ok Perfect. 10
Test #6:
score: 10
Accepted
time: 1ms
memory: 5944kb
input:
5 5 3969271731891539589 872380446563047377
output:
4123764187658
result:
ok Perfect. 10
Test #7:
score: 10
Accepted
time: 1ms
memory: 6040kb
input:
5 5 10791248432551339097 10907238234860663613
output:
4123764187658
result:
ok Perfect. 10
Test #8:
score: 10
Accepted
time: 1ms
memory: 5960kb
input:
5 5 4133452284370185751 8351536681439074389
output:
4123764187658
result:
ok Perfect. 10
Test #9:
score: 10
Accepted
time: 1ms
memory: 6088kb
input:
5 5 4588466072500947787 2668799652971323944
output:
4123764187658
result:
ok Perfect. 10
Test #10:
score: 10
Accepted
time: 1ms
memory: 6060kb
input:
5 5 14152525429264304911 13775135703660625045
output:
4123764187658
result:
ok Perfect. 10
Test #11:
score: 10
Accepted
time: 1ms
memory: 6040kb
input:
5 5 7421526808561975748 10544499515413224856
output:
4123764187658
result:
ok Perfect. 10
Test #12:
score: 10
Accepted
time: 0ms
memory: 6048kb
input:
5 5 10533068226990172617 16920379813521486362
output:
4123764187658
result:
ok Perfect. 10
Test #13:
score: 10
Accepted
time: 1ms
memory: 6024kb
input:
5 5 12984923981069466020 10402168891728084823
output:
4123764187658
result:
ok Perfect. 10
Test #14:
score: 10
Accepted
time: 1ms
memory: 6024kb
input:
5 5 4547699393608837176 17811338561394180193
output:
4123764187658
result:
ok Perfect. 10
Test #15:
score: 10
Accepted
time: 1ms
memory: 6156kb
input:
5 5 7797814030854767695 12994778421940209897
output:
4123764187658
result:
ok Perfect. 10
Test #16:
score: 10
Accepted
time: 0ms
memory: 5960kb
input:
5 5 13586090146748389854 8573353291555348877
output:
4123764187658
result:
ok Perfect. 10
Test #17:
score: 10
Accepted
time: 1ms
memory: 6152kb
input:
5 5 7492677468637862337 17412579963708759713
output:
4123764187658
result:
ok Perfect. 10
Test #18:
score: 10
Accepted
time: 1ms
memory: 6020kb
input:
5 5 12538610689378370624 10934031436815865430
output:
4123764187658
result:
ok Perfect. 10
Test #19:
score: 10
Accepted
time: 0ms
memory: 6044kb
input:
5 5 6318529188948278594 4765084946625953274
output:
4123764187658
result:
ok Perfect. 10
Test #20:
score: 10
Accepted
time: 0ms
memory: 6016kb
input:
5 5 12764462787770553234 16031550997283183642
output:
4123764187658
result:
ok Perfect. 10
Test #21:
score: 10
Accepted
time: 0ms
memory: 6080kb
input:
5 5 16850625473722229566 12858849229956583645
output:
4123764187658
result:
ok Perfect. 10
Test #22:
score: 10
Accepted
time: 1ms
memory: 5992kb
input:
5 5 3916752702561709368 14568996895902750709
output:
4123764187658
result:
ok Perfect. 10
Test #23:
score: 10
Accepted
time: 1ms
memory: 6032kb
input:
5 5 2793964619809963444 14799430123914266097
output:
4123764187658
result:
ok Perfect. 10
Test #24:
score: 10
Accepted
time: 0ms
memory: 6088kb
input:
5 5 14022384786197322639 15644367891444293842
output:
4123764187658
result:
ok Perfect. 10
Test #25:
score: 10
Accepted
time: 0ms
memory: 6028kb
input:
5 5 4677661251438971503 7860382546781589019
output:
4123764187658
result:
ok Perfect. 10
Test #26:
score: 10
Accepted
time: 0ms
memory: 7988kb
input:
5 5 865745884266339793 3234925754863119957
output:
4123764187658
result:
ok Perfect. 10
Test #27:
score: 10
Accepted
time: 1ms
memory: 5960kb
input:
5 5 16601073251043052245 5101181031338699631
output:
4123764187658
result:
ok Perfect. 10
Test #28:
score: 10
Accepted
time: 0ms
memory: 5964kb
input:
5 5 4666335567338264413 17869704479146009894
output:
4123764187658
result:
ok Perfect. 10
Test #29:
score: 10
Accepted
time: 0ms
memory: 6048kb
input:
5 5 10276076269669835904 6933906736047769186
output:
4123764187658
result:
ok Perfect. 10
Test #30:
score: 10
Accepted
time: 0ms
memory: 5960kb
input:
5 5 3547072148765339907 5805660413096765891
output:
4123764187658
result:
ok Perfect. 10
Test #31:
score: 10
Accepted
time: 1ms
memory: 6020kb
input:
5 5 5905632931049428772 15089509813347254316
output:
4123764187658
result:
ok Perfect. 10
Test #32:
score: 10
Accepted
time: 0ms
memory: 7988kb
input:
5 5 6148686139569402051 6521476089554108987
output:
4123764187658
result:
ok Perfect. 10
Test #33:
score: 10
Accepted
time: 0ms
memory: 6148kb
input:
5 5 10293582518274215475 2676706070504789810
output:
4123764187658
result:
ok Perfect. 10
Test #34:
score: 10
Accepted
time: 1ms
memory: 6020kb
input:
5 5 6589510135221577212 2537901023039331965
output:
4123764187658
result:
ok Perfect. 10
Test #35:
score: 10
Accepted
time: 0ms
memory: 6028kb
input:
5 5 5329171491039567345 943883204937169735
output:
4123764187658
result:
ok Perfect. 10
Test #36:
score: 10
Accepted
time: 0ms
memory: 5968kb
input:
5 5 18153714120372683774 16958100625183201027
output:
4123764187658
result:
ok Perfect. 10
Subtask #2:
score: 0
Wrong Answer
Test #37:
score: 10
Accepted
time: 15ms
memory: 30300kb
input:
1000 1 17833636513278974999 18032835279213373306
output:
4123764187658
result:
ok Perfect. 10
Test #38:
score: 10
Accepted
time: 11ms
memory: 31340kb
input:
1000 1 14730911653810224758 12266600726496100996
output:
4123764187658
result:
ok Perfect. 10
Test #39:
score: 10
Accepted
time: 11ms
memory: 31020kb
input:
1000 1 8799733959292548924 5387063902427699037
output:
4123764187658
result:
ok Perfect. 10
Test #40:
score: 0
Wrong Answer
time: 11ms
memory: 30204kb
input:
1000 1 9630334707439747607 4291049102998855878
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #3:
score: 0
Wrong Answer
Test #73:
score: 0
Wrong Answer
time: 18ms
memory: 30216kb
input:
1000 10 7581650225429700886 16046788410942473709
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #4:
score: 0
Wrong Answer
Test #109:
score: 0
Wrong Answer
time: 13ms
memory: 31004kb
input:
1000 30 15510757929061591914 2629686482095382587
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #5:
score: 10
Accepted
Test #145:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 341353812123787886 3685575517089631424
output:
4123764187658
result:
ok Perfect. 10
Test #146:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 17554024470069985393 14526118928412869541
output:
4123764187658
result:
ok Perfect. 10
Test #147:
score: 10
Accepted
time: 1ms
memory: 5956kb
input:
3 1000 11100872062048687810 2436800177126848628
output:
4123764187658
result:
ok Perfect. 10
Test #148:
score: 10
Accepted
time: 1ms
memory: 5948kb
input:
3 1000 12273008098306225590 16096411110101172825
output:
4123764187658
result:
ok Perfect. 10
Test #149:
score: 10
Accepted
time: 1ms
memory: 6004kb
input:
3 1000 5654804106297455579 15032882241153944630
output:
4123764187658
result:
ok Perfect. 10
Test #150:
score: 10
Accepted
time: 1ms
memory: 5972kb
input:
3 1000 11657166324406481549 9353824690667677565
output:
4123764187658
result:
ok Perfect. 10
Test #151:
score: 10
Accepted
time: 1ms
memory: 6056kb
input:
3 1000 9856996265363358370 1303189576722459924
output:
4123764187658
result:
ok Perfect. 10
Test #152:
score: 10
Accepted
time: 0ms
memory: 5992kb
input:
3 1000 13762958351315737777 17656605426995507653
output:
4123764187658
result:
ok Perfect. 10
Test #153:
score: 10
Accepted
time: 0ms
memory: 5932kb
input:
3 1000 6594820974237499008 8275191558646832971
output:
4123764187658
result:
ok Perfect. 10
Test #154:
score: 10
Accepted
time: 0ms
memory: 6056kb
input:
3 1000 15364608258723563115 6775374271333152271
output:
4123764187658
result:
ok Perfect. 10
Test #155:
score: 10
Accepted
time: 0ms
memory: 5964kb
input:
3 1000 8632788633816311118 11344661582645288445
output:
4123764187658
result:
ok Perfect. 10
Test #156:
score: 10
Accepted
time: 1ms
memory: 6060kb
input:
3 1000 3761871134959282714 6665092712492706442
output:
4123764187658
result:
ok Perfect. 10
Test #157:
score: 10
Accepted
time: 1ms
memory: 6012kb
input:
3 1000 7094498594234606872 8910549019427251768
output:
4123764187658
result:
ok Perfect. 10
Test #158:
score: 10
Accepted
time: 0ms
memory: 5940kb
input:
3 1000 3150940857228445655 13881058163925087748
output:
4123764187658
result:
ok Perfect. 10
Test #159:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 4138134701063904295 1719971509658971853
output:
4123764187658
result:
ok Perfect. 10
Test #160:
score: 10
Accepted
time: 1ms
memory: 5944kb
input:
3 1000 5958659699359151667 2414251605389031835
output:
4123764187658
result:
ok Perfect. 10
Test #161:
score: 10
Accepted
time: 1ms
memory: 5996kb
input:
3 1000 5944678764869264249 12798935463560265075
output:
4123764187658
result:
ok Perfect. 10
Test #162:
score: 10
Accepted
time: 1ms
memory: 5944kb
input:
3 1000 4284102408051741763 14814507977658888488
output:
4123764187658
result:
ok Perfect. 10
Test #163:
score: 10
Accepted
time: 1ms
memory: 5944kb
input:
3 1000 68627333965422180 112502394402464737
output:
4123764187658
result:
ok Perfect. 10
Test #164:
score: 10
Accepted
time: 1ms
memory: 6024kb
input:
3 1000 9425733985639080184 7223503398227154738
output:
4123764187658
result:
ok Perfect. 10
Test #165:
score: 10
Accepted
time: 1ms
memory: 6000kb
input:
3 1000 8943577954292636643 17050920714073219153
output:
4123764187658
result:
ok Perfect. 10
Test #166:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 11496811535444871688 17614364677931546223
output:
4123764187658
result:
ok Perfect. 10
Test #167:
score: 10
Accepted
time: 1ms
memory: 5984kb
input:
3 1000 11326082696967067008 15441004054432712190
output:
4123764187658
result:
ok Perfect. 10
Test #168:
score: 10
Accepted
time: 1ms
memory: 6092kb
input:
3 1000 674874697473693630 12649997796392211087
output:
4123764187658
result:
ok Perfect. 10
Test #169:
score: 10
Accepted
time: 1ms
memory: 5952kb
input:
3 1000 1277251190199972050 14038814491796751538
output:
4123764187658
result:
ok Perfect. 10
Test #170:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 9145151749445284299 14293688652236038951
output:
4123764187658
result:
ok Perfect. 10
Test #171:
score: 10
Accepted
time: 1ms
memory: 7920kb
input:
3 1000 15904416939287794082 14428505338208190980
output:
4123764187658
result:
ok Perfect. 10
Test #172:
score: 10
Accepted
time: 1ms
memory: 5940kb
input:
3 1000 6941291132256775130 12849312109895089494
output:
4123764187658
result:
ok Perfect. 10
Test #173:
score: 10
Accepted
time: 1ms
memory: 5936kb
input:
3 1000 17548422519337327843 202236826264518662
output:
4123764187658
result:
ok Perfect. 10
Test #174:
score: 10
Accepted
time: 0ms
memory: 5960kb
input:
3 1000 17860234706011656272 8403215217493848355
output:
4123764187658
result:
ok Perfect. 10
Test #175:
score: 10
Accepted
time: 0ms
memory: 5948kb
input:
3 1000 13237681186403336364 1756180179264870639
output:
4123764187658
result:
ok Perfect. 10
Test #176:
score: 10
Accepted
time: 0ms
memory: 6124kb
input:
3 1000 10003937773928046600 7429936390634919158
output:
4123764187658
result:
ok Perfect. 10
Test #177:
score: 10
Accepted
time: 0ms
memory: 6020kb
input:
3 1000 14525148579459393729 1812692019584178560
output:
4123764187658
result:
ok Perfect. 10
Test #178:
score: 10
Accepted
time: 1ms
memory: 5952kb
input:
3 1000 9397110039933932416 8176227936526769663
output:
4123764187658
result:
ok Perfect. 10
Test #179:
score: 10
Accepted
time: 1ms
memory: 5996kb
input:
3 1000 5937527883284015772 13220661886981109044
output:
4123764187658
result:
ok Perfect. 10
Test #180:
score: 10
Accepted
time: 1ms
memory: 6016kb
input:
3 1000 16390577403064012729 17586432346005845474
output:
4123764187658
result:
ok Perfect. 10
Subtask #6:
score: 0
Wrong Answer
Test #181:
score: 10
Accepted
time: 1ms
memory: 6056kb
input:
10 1000 18326939717248212778 15447461170187547045
output:
4123764187658
result:
ok Perfect. 10
Test #182:
score: 0
Wrong Answer
time: 1ms
memory: 6104kb
input:
10 1000 14303031343316484183 9472080590628751829
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #7:
score: 0
Wrong Answer
Test #217:
score: 0
Wrong Answer
time: 13ms
memory: 20024kb
input:
500 1000 3911210051670624968 2787181900148297327
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #8:
score: 0
Wrong Answer
Test #253:
score: 0
Wrong Answer
time: 26ms
memory: 32108kb
input:
1000 1000 2442055921391744378 15448328346037637846
output:
4123764187648
result:
points 0.0 Correct Answer. 0
Subtask #9:
score: 0
Wrong Answer
Test #289:
score: 10
Accepted
time: 50ms
memory: 44240kb
input:
1500 1500 8660688640427922501 1436138393991664715
output:
4123764187658
result:
ok Perfect. 10
Test #290:
score: 0
Wrong Answer
time: 45ms
memory: 45316kb
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: 99ms
memory: 57456kb
input:
2000 2000 6596342253746377097 6195418207254921855
output:
4123764187648
result:
points 0.0 Correct Answer. 0