QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#699750#6770. Antsjkliao#WA 609ms73544kbC++171.0kb2024-11-02 10:36:352024-11-02 10:36:35

Judging History

This is the latest submission verdict.

  • [2024-11-02 10:36:35]
  • Judged
  • Verdict: WA
  • Time: 609ms
  • Memory: 73544kb
  • [2024-11-02 10:36:35]
  • Submitted

answer

#include <iostream>
#include <queue>
#include <set>
#include <vector>
using namespace std;

using ll = unsigned long long;
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  int x = min(a, b);
  // a = x % n;
  // b = x % n;
  a -= (x / n) * (n);
  b -= (x / n) * (n);
  ll ans = (ll)(x / n) * (2e9 + 2);
  vector<ll> pos(n);
  for (int i = 0; i < n; i++)
    cin >> pos[i];
  set<pair<ll, int>> pq;
  for (int i = 0; i < n; i++) {
    int d;
    cin >> d;
    if (d == 0) {
      pq.emplace(pos[i], 0);
    } else {
      pq.emplace(1e9 + 1 - pos[i], 1);
    }
  }
  ll finishtime = 0;
  while (!pq.empty()) {
    auto pp = *pq.begin();
    // cout << pp.first << ' ' << pp.second << endl;
    pq.erase(pq.begin());
    finishtime = max(finishtime, pp.first);
    if (pp.second == 0) {
      if (a != 0) {
        a--;
        pq.emplace(pp.first + (1e9 + 1), 1);
      }
    } else {
      if (b != 0) {
        b--;
        pq.emplace(pp.first + (1e9 + 1), 0);
      }
    }
  }
  cout << finishtime + ans << endl;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3856kb

input:

2 2 4
2 3
0 1

output:

4000000001

result:

ok single line: '4000000001'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3860kb

input:

1 1000000000 1000000000
500000000
0

output:

2000000002500000000

result:

ok single line: '2000000002500000000'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

1 1000000000 500000000
500000000
1

output:

1000000001500000001

result:

ok single line: '1000000001500000001'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

1 500000000 1000000000
500000000
0

output:

1000000001500000000

result:

ok single line: '1000000001500000000'

Test #5:

score: 0
Accepted
time: 528ms
memory: 73468kb

input:

999963 1000000000 1000000000
516 793 2609 2721 3010 3378 4494 6294 7719 9298 9582 10021 10255 13552 16357 16771 16864 18824 19006 19162 19583 22099 22970 23637 25760 26962 29349 31140 34093 34398 35622 35765 35868 35899 36213 37137 38062 43181 43361 44347 46328 48145 48188 49187 50303 50873 52999 53...

output:

2001074431727

result:

ok single line: '2001074431727'

Test #6:

score: 0
Accepted
time: 602ms
memory: 73504kb

input:

999941 999999994 45
453 2109 2238 3231 3840 4691 4822 5559 6256 6442 6920 8050 8105 9675 9797 13409 13737 15144 15475 15587 16603 17043 18103 24109 24567 25049 25689 26332 26874 27134 27681 28947 29323 32220 32520 33158 34724 35001 36274 36281 39527 39874 42474 43062 44818 44970 46621 47409 47725 51...

output:

2000108375

result:

ok single line: '2000108375'

Test #7:

score: 0
Accepted
time: 544ms
memory: 73348kb

input:

999954 999999992 999999995
272 628 870 1898 4875 5419 6672 7510 8281 8480 10628 11082 11578 11704 12214 19522 19961 20795 23423 24662 25350 26316 26502 26857 27852 28108 29041 29612 30217 30535 30923 39387 40976 41786 43389 43419 44165 45018 45713 46758 47369 47820 48741 49662 49744 50338 50621 5254...

output:

2001092829852

result:

ok single line: '2001092829852'

Test #8:

score: 0
Accepted
time: 521ms
memory: 73332kb

input:

999932 999999990 999999998
767 1018 1122 4926 5456 6067 6360 10727 11947 13239 13448 14168 15069 16955 17691 18246 18317 18558 19064 20330 21643 22170 23288 24259 26044 26061 26281 26459 26851 27319 27515 27941 29256 30281 30478 30649 31271 33013 33573 33954 34554 34880 37476 38058 41350 41720 41987...

output:

2001136539839

result:

ok single line: '2001136539839'

Test #9:

score: 0
Accepted
time: 576ms
memory: 73544kb

input:

999978 96 999999991
597 1007 2312 2597 3025 3410 4879 5383 7284 9320 9519 10185 11052 11067 11161 12073 14258 14773 15803 17308 17411 19719 24899 25162 25737 27314 28146 28993 29374 29593 29781 31053 31437 33433 34309 36664 37525 38263 41140 43162 43556 44728 45312 48836 49037 50314 51097 51700 5216...

output:

2000225911

result:

ok single line: '2000225911'

Test #10:

score: 0
Accepted
time: 523ms
memory: 73456kb

input:

999956 999999996 999999993
200 3463 4333 5570 7107 8968 9380 11533 15286 15767 17969 18845 20264 22193 23283 23700 24335 24493 24871 26052 27077 27293 27780 28299 29436 29874 30149 30394 31504 34650 35577 35639 38236 38256 39038 39136 39503 39994 40259 41104 41710 44812 45908 46945 47060 47711 49202...

output:

2001088216866

result:

ok single line: '2001088216866'

Test #11:

score: 0
Accepted
time: 609ms
memory: 73448kb

input:

999969 41 999999994
1347 1679 3964 6473 7040 9664 10582 10874 11346 12413 12917 13477 13581 16344 16465 16698 16908 17687 17921 20724 21753 22203 22326 23340 24613 25269 25936 28029 28557 28880 31422 39124 42069 42902 43335 43946 44765 46265 46880 47563 48615 48721 50424 50885 50996 52665 53445 5412...

output:

2000085628

result:

ok single line: '2000085628'

Test #12:

score: 0
Accepted
time: 532ms
memory: 73480kb

input:

999947 999999995 999999992
176 688 1670 1770 2381 5132 6311 7913 8238 12291 17276 17552 17894 19483 19512 20273 21673 22264 22919 24572 25936 29238 29865 31502 31994 32722 36294 36816 37557 38162 38525 38824 39485 39940 40770 41595 42400 43037 43071 43520 43747 43996 44523 48093 48095 51409 51531 53...

output:

2001106795655

result:

ok single line: '2001106795655'

Test #13:

score: -100
Wrong Answer
time: 0ms
memory: 3824kb

input:

11 1000000000 1000000000
50693326 64287416 146120903 221418321 236537210 384599687 470661796 591914724 684157773 898390709 958420789
0 0 1 1 0 0 0 0 0 0 1

output:

181818182960399858

result:

wrong answer 1st lines differ - expected: '181818182960399862', found: '181818182960399858'