ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#159131 | #227. random | bitsstdcheee | 100 | 1598ms | 9852kb | C++ | 1.6kb | 2022-09-21 17:20:09 | 2022-09-21 17:20:18 |
answer
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;
long long ca, cb;
int sa[1000010], sb[1000010];
int ia[100010], ib[100010];
int ma = -1, mb = -1;
int n, t;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> t;
while (t--) {
ma = mb = -1;
ca = cb = 0;
memset(sa, 0, sizeof sa);
memset(sb, 0, sizeof sb);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> ia[i];
ma = max(ma, ia[i]);
}
sort(ia + 1, ia + n + 1);
for (int i = 1; i <= n; i++) sa[ia[i]]++;
for (int i = 1; i <= n; i++) {
cin >> ib[i];
mb = max(mb, ib[i]);
}
sort(ib + 1, ib + n + 1);
for (int i = 1; i <= n; i++) sb[ib[i]]++;
sa[n + 1] = sb[n + 1] = 0;
for (int i = 1; i <= max(ma, mb); i++) {
sa[i] += sa[i - 1];
sb[i] += sb[i - 1];
}
// for (int i = 1; i <= ma; i++) cout << sa[i] << " ";
// cout << endl;
// for (int i = 1; i <= mb; i++) cout << sb[i] << " ";
// cout << endl;
for (int i = 1; i <= n; i++) {
ca += (long long)sb[ia[i]];
// cout << ca << endl;
}
for (int i = 1; i <= n; i++) {
cb += (long long)sa[ib[i]];
// cout << cb << endl;
}
// cout << ca << " " << cb << endl;
if (ca > cb) cout << "Alice" << endl;
else if (ca < cb) cout << "Bob" << endl;
else cout << "Tie" << endl;
}
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Test #1:
score: 10
Accepted
time: 30ms
memory: 9084kb
input:
10 1000 101215 213370 853573 556809 576787 831897 820627 832617 819277 407455 483615 672899 835594 3...
output:
Alice Alice Bob Alice Alice Bob Bob Alice Alice Alice
result:
ok 10 lines
Test #2:
score: 10
Accepted
time: 30ms
memory: 9084kb
input:
10 1000 726572 630317 792678 34049 443782 297049 565292 47174 349955 333016 418996 708341 819288 920...
output:
Alice Bob Alice Alice Bob Bob Alice Alice Alice Alice
result:
ok 10 lines
Test #3:
score: 10
Accepted
time: 27ms
memory: 9084kb
input:
10 1000 672153 407098 98222 837830 790709 973955 819359 508851 467617 50563 720647 128305 191590 921...
output:
Bob Alice Bob Bob Bob Alice Bob Alice Alice Bob
result:
ok 10 lines
Test #4:
score: 10
Accepted
time: 23ms
memory: 9084kb
input:
10 1000 983561 839734 945863 171639 28630 174616 124538 701582 440330 411841 386200 584592 604303 81...
output:
Alice Alice Alice Alice Bob Alice Bob Bob Alice Alice
result:
ok 10 lines
Test #5:
score: 10
Accepted
time: 27ms
memory: 9088kb
input:
10 1000 804549 749001 547843 412181 194796 120977 171088 137799 296893 155632 247002 586601 338092 3...
output:
Bob Alice Bob Bob Bob Alice Bob Bob Bob Bob
result:
ok 10 lines
Test #6:
score: 10
Accepted
time: 32ms
memory: 9088kb
input:
10 1000 104636 728452 850974 588963 661234 559307 718748 339759 364748 557 543632 602736 143807 6536...
output:
Bob Alice Alice Alice Alice Alice Bob Alice Bob Bob
result:
ok 10 lines
Test #7:
score: 10
Accepted
time: 310ms
memory: 9852kb
input:
10 100000 959809 7522 973124 122563 501139 86200 151864 669643 885173 722057 411912 627224 703986 36...
output:
Bob Bob Alice Alice Bob Bob Bob Alice Alice Tie
result:
ok 10 lines
Test #8:
score: 10
Accepted
time: 426ms
memory: 9852kb
input:
10 100000 492550 252620 164472 816290 942301 851945 192440 79614 597695 278279 342292 71636 163373 9...
output:
Alice Alice Bob Bob Alice Bob Bob Bob Alice Tie
result:
ok 10 lines
Test #9:
score: 10
Accepted
time: 380ms
memory: 9848kb
input:
10 100000 464109 432323 874881 300908 659763 674722 32703 260646 495037 83277 893267 817700 939508 8...
output:
Alice Alice Bob Bob Alice Bob Bob Alice Alice Tie
result:
ok 10 lines
Test #10:
score: 10
Accepted
time: 313ms
memory: 9852kb
input:
10 100000 778478 218818 519364 642551 48000 845682 293702 267599 874080 997029 553067 830719 561770 ...
output:
Alice Alice Alice Bob Alice Bob Bob Alice Bob Tie
result:
ok 10 lines