QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#23906 | #1842. Math | DoorKickers | TL | 103ms | 10368kb | C++20 | 626b | 2022-03-20 18:44:45 | 2022-04-30 04:24:22 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<int> a(n + 1);
map<int, int> cnt;
int mx = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
mx = max(mx, a[i]);
cnt[a[i]] = 1;
}
int ans = 0;
for (int i = 1; i <= mx; i++) {
for (int j = i; j * i <= mx; j++) {
if ((j - i) % 2 == 0 && cnt[(j - i) / 2] && cnt[i * j]) {
ans++;
}
}
}
cout << ans << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 3532kb
input:
5 1 2 3 4 5
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3696kb
input:
1 1
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
5 6 4 7 3 5
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 2ms
memory: 3508kb
input:
50 89 2 3 86 81 59 29 26 28 8 48 5 6 95 54 91 17 83 4 36 15 43 92 70 30 37 23 96 39 80 9 90 49 82 33 71 61 38 99 50 65 47 78 45 68 7 25 42 13 57
output:
29
result:
ok 1 number(s): "29"
Test #5:
score: 0
Accepted
time: 3ms
memory: 3776kb
input:
1000 662 811 263 46 591 511 230 223 628 603 716 880 187 575 701 184 505 754 130 154 367 91 704 945 171 588 19 486 34 513 622 849 629 437 776 290 743 470 587 681 723 271 879 642 77 281 71 655 365 942 809 94 266 148 146 305 198 311 788 69 343 277 887 557 169 41 784 791 451 812 932 663 594 576 487 946 ...
output:
1750
result:
ok 1 number(s): "1750"
Test #6:
score: 0
Accepted
time: 9ms
memory: 4264kb
input:
10000 2246 4941 6031 8713 4705 3744 9374 9432 2502 7080 8851 5408 4724 8905 7565 1699 6660 8959 7798 2287 4610 8806 8128 451 1355 2111 8775 4903 7517 8983 8144 2578 9565 7332 3213 4943 6520 616 2559 5573 6391 7148 5121 8395 5618 8733 6132 3717 8549 9651 1291 9462 5941 2342 9625 398 3916 8586 4290 26...
output:
23368
result:
ok 1 number(s): "23368"
Test #7:
score: 0
Accepted
time: 103ms
memory: 10368kb
input:
100000 94437 49936 62522 1166 33452 90618 91436 81173 99242 37280 46125 44869 52811 45694 11550 29857 48941 56538 35057 40907 79925 70785 29658 19044 32804 11428 4127 92197 12680 61636 27200 56790 83389 80340 54411 15308 38952 78085 81397 37554 44186 33581 35662 73331 84991 32044 69012 82289 63495 6...
output:
291528
result:
ok 1 number(s): "291528"
Test #8:
score: -100
Time Limit Exceeded
input:
1000000 287979 230793 805881 397585 695359 701731 296206 140797 257828 646397 649020 775370 622178 482759 161855 499413 690372 463229 541524 906954 116709 106321 17736 555558 848745 804067 532778 605445 239082 752084 465207 248311 821443 697678 323802 224937 607056 905999 886110 635290 199168 451068...