QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#798762 | #9671. Container Scheduling | ucup-team004 | AC ✓ | 1ms | 3880kb | C++23 | 1.3kb | 2024-12-04 16:48:32 | 2024-12-04 16:48:34 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, l, h;
std::cin >> n >> l >> h;
std::set<int> cx {0}, cy {0};
std::vector<int> a(n), b(n), x(n, -1), y(n, -1);
for (int i = 0; i < n; i++) {
std::cin >> a[i] >> b[i];
for (auto vx : cx) {
for (auto vy : cy) {
if (vx + a[i] > l || vy + b[i] > h) {
continue;
}
int ok = 1;
for (int j = 0; j < i; j++) {
if (!(x[j] == -1 || vx >= x[j] + a[j] || vx + a[i] <= x[j] || vy >= y[j] + b[j] || vy + b[i] <= y[j])) {
ok = 0;
}
}
if (ok) {
x[i] = vx;
y[i] = vy;
cx.insert(vx + a[i]);
cy.insert(vy + b[i]);
break;
}
}
if (x[i] != -1) {
break;
}
}
if (x[i] == -1) {
std::cout << -1 << "\n";
} else {
std::cout << x[i] << " " << y[i] << "\n";
}
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3580kb
input:
4 10 10 5 5 6 6 4 7 10 2
output:
0 0 -1 5 0 0 7
result:
ok 4 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
6 10 10 1 7 7 2 7 9 6 1 1 9 5 9
output:
0 0 0 7 -1 0 9 7 0 -1
result:
ok 6 lines
Test #3:
score: 0
Accepted
time: 0ms
memory: 3612kb
input:
26 10 10 8 9 10 4 8 7 8 5 7 4 8 4 6 7 6 10 3 2 6 2 10 7 4 7 1 8 1 3 6 9 8 4 1 8 6 6 8 10 4 8 3 9 5 10 7 2 3 7 8 8 5 7
output:
0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 8 0 9 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 26 lines
Test #4:
score: 0
Accepted
time: 1ms
memory: 3640kb
input:
50 1000000000 1000000000 1 650222700 1 937314673 65745994 1 1 121355682 153622819 1 1 912746695 446032207 1 1 237366971 1 375410427 1 397648585 1 104376999 1 675475408 1 969397942 1 552197186 1 38753647 1 354513713 1 727783934 804619239 1 1 979879005 1 272971203 903389475 1 836189765 1 1 276618665 1...
output:
0 0 1 0 0 937314673 0 650222700 0 937314674 2 0 0 937314675 3 0 3 237366971 4 0 0 771578382 5 0 446032207 0 6 0 0 875955381 4 397648585 7 0 0 969397942 804619239 0 3 612777398 0 979879005 0 979879006 6 552197186 8 0 0 979879007 0 937314676 9 0 0 979879008 446032208 0 10 0 11 0 12 0 0 979879009 0 969...
result:
ok 50 lines
Test #5:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
1 1000000000 1000000000 1000000000 1000000000
output:
0 0
result:
ok single line: '0 0'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
2 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
output:
0 0 -1
result:
ok 2 lines
Test #7:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
50 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
0 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 50 lines
Test #8:
score: 0
Accepted
time: 1ms
memory: 3880kb
input:
50 1 1000000000 1 838634 1 832314 1 604296 1 259120 1 142314 1 91168 1 277632 1 824338 1 225676 1 935077 1 565287 1 939913 1 239100 1 300165 1 627979 1 717362 1 73639 1 847229 1 966393 1 569449 1 20667 1 564811 1 280765 1 751884 1 593507 1 409067 1 284260 1 645880 1 389133 1 941786 1 2941 1 904202 1...
output:
0 0 0 838634 0 1670948 0 2275244 0 2534364 0 2676678 0 2767846 0 3045478 0 3869816 0 4095492 0 5030569 0 5595856 0 6535769 0 6774869 0 7075034 0 7703013 0 8420375 0 8494014 0 9341243 0 10307636 0 10877085 0 10897752 0 11462563 0 11743328 0 12495212 0 13088719 0 13497786 0 13782046 0 14427926 0 14817...
result:
ok 50 lines
Test #9:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
10 10 1000000000 10 328807932 3 238017886 7 640019398 5 269599384 4 578090134 8 964356006 9 413809369 9 572075688 3 172892031 9 411843199
output:
0 0 0 328807932 3 328807932 -1 -1 -1 -1 -1 0 566825818 -1
result:
ok 10 lines
Test #10:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
50 10 1000000000 2 532974641 8 120622724 2 935428389 7 437294944 10 688326999 4 569948421 8 445372288 10 496491645 1 348868121 3 420768470 5 114685923 6 780003231 8 101093472 1 789945199 8 831807063 6 10656351 10 778869844 2 577054347 8 40240933 2 513951380 2 530433630 7 289042464 6 651296470 5 7924...
output:
0 0 0 532974641 8 0 -1 -1 -1 -1 -1 2 0 3 0 0 653597365 -1 0 768283288 -1 -1 0 869376760 -1 -1 0 880033111 6 0 -1 -1 -1 -1 0 920274044 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 2 420768470 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 50 lines
Test #11:
score: 0
Accepted
time: 0ms
memory: 3576kb
input:
50 10 10 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 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1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
output:
0 0 0 1 0 2 0 3 0 4 1 0 1 1 1 2 1 3 1 4 2 0 2 1 2 2 2 3 2 4 3 0 3 1 3 2 3 3 3 4 4 0 4 1 4 2 4 3 4 4 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
result:
ok 50 lines
Test #14:
score: 0
Accepted
time: 0ms
memory: 3616kb
input:
30 10 10 2 9 7 7 4 7 3 2 1 4 8 5 4 10 7 8 2 7 1 10 9 5 1 5 7 1 10 9 3 1 5 8 7 2 9 7 10 2 7 8 10 3 10 8 1 1 5 10 7 3 7 2 10 6 9 7 10 6 2 9
output:
0 0 2 0 -1 2 7 9 0 -1 -1 -1 -1 -1 -1 9 4 0 9 -1 5 7 -1 -1 -1 -1 -1 -1 -1 5 8 -1 -1 -1 -1 -1 -1 -1
result:
ok 30 lines
Test #15:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
50 100 100 24 5 29 100 84 18 78 93 74 3 53 39 69 69 46 22 54 55 35 40 6 71 49 77 15 61 27 72 91 68 87 40 45 62 78 3 6 60 64 14 21 93 38 3 11 58 43 2 88 88 91 49 1 54 99 80 84 66 39 38 22 89 30 90 32 48 50 30 6 83 13 76 63 54 61 75 92 47 81 26 77 62 34 90 34 49 11 88 99 60 97 88 48 22 24 12 74 38 64 29
output:
0 0 24 0 -1 -1 -1 -1 -1 53 0 -1 53 22 0 5 -1 6 5 -1 -1 -1 -1 -1 88 22 -1 -1 53 82 -1 53 85 -1 -1 21 5 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 76 -1 -1
result:
ok 50 lines
Test #16:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
50 1000 1000 645 405 785 223 820 831 700 535 623 797 397 454 139 61 186 124 544 787 317 200 168 527 252 834 6 794 449 584 972 310 146 105 859 851 290 941 695 794 214 387 665 182 986 264 987 422 138 335 359 373 361 860 433 250 501 920 608 161 552 952 1 391 73 958 836 737 401 446 445 470 607 194 172 2...
output:
0 0 0 405 -1 -1 -1 -1 0 628 0 689 -1 186 628 785 0 -1 953 0 -1 -1 0 813 -1 -1 -1 -1 -1 -1 -1 503 628 -1 -1 -1 -1 -1 -1 645 0 -1 -1 -1 -1 -1 641 628 -1 -1 -1 -1 -1 0 918 -1 -1 -1 -1 -1 646 0 -1
result:
ok 50 lines
Test #17:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
10 1000000000 1000000000 2 6 7 2 1 4 4 1 3 1 10 10 1 1 9 8 4 6 3 7
output:
0 0 0 6 0 8 0 12 0 13 0 14 0 24 0 25 0 33 0 39
result:
ok 10 lines
Test #18:
score: 0
Accepted
time: 0ms
memory: 3804kb
input:
10 1000000000 1000000000 975410996 758156269 577694781 712006877 391643763 603210918 546202684 723473172 575646517 575063575 531748452 244648920 488090132 162772168 18467504 867841544 42746114 27999466 262121473 526184247
output:
0 0 -1 -1 -1 -1 -1 0 758156269 975410996 0 0 920928437 -1
result:
ok 10 lines
Test #19:
score: 0
Accepted
time: 0ms
memory: 3636kb
input:
10 1000000000 1000000000 498338398 538276511 688943943 541660392 590767447 461630292 934179989 590942818 236896310 413442718 146585850 978908523 352201685 708530178 343476946 152321722 235834420 865418377 311457758 995941066
output:
0 0 -1 0 538276511 -1 498338398 0 735234708 0 -1 -1 -1 -1
result:
ok 10 lines
Test #20:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
30 1000000000 1000000000 354790422 520782848 133896502 196972951 818379600 197507496 487018578 200634445 766690593 206463467 412241560 705726358 610021072 504148916 576813217 829350624 926368617 730392848 960845579 277471993 771973178 255361969 373177079 545575574 994824023 242977646 744979082 15960...
output:
0 0 0 520782848 0 717755799 354790422 0 -1 -1 354790422 200634445 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 0 915263295 -1 -1 133896502 520782848 -1 -1 -1
result:
ok 30 lines
Test #21:
score: 0
Accepted
time: 0ms
memory: 3580kb
input:
50 1000000000 1000000000 61499342 648513376 19040549 852285511 340959049 83127804 599665679 810326072 441709068 589418808 677897270 137576898 722616267 154543461 400084081 211412229 172192414 890334614 465009209 559002919 729198465 8397858 265942061 629741265 118777045 186107684 888510096 50027697 7...
output:
0 0 61499342 0 0 852285511 80539891 0 -1 -1 -1 -1 680205570 0 -1 0 935413315 -1 852397984 0 0 943811173 -1 -1 -1 -1 -1 -1 -1 -1 852397984 186107684 915587370 186107684 -1 -1 -1 -1 -1 -1 915587370 463402513 -1 -1 -1 -1 967839108 463402513 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 983111242 463402513 -1 -1 -1
result:
ok 50 lines
Extra Test:
score: 0
Extra Test Passed