QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637839 | #9231. Random Numbers | propane# | WA | 54ms | 4780kb | C++20 | 904b | 2024-10-13 14:12:54 | 2024-10-13 14:12:55 |
Judging History
answer
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
using LL = long long;
int main(){
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("data.out", "w", stdout);
#endif
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int T;
cin >> T;
while(T--){
int n;
cin >> n;
vector<LL> s(n + 1);
for(int i = 1; i <= n; i++){
cin >> s[i];
s[i] += s[i - 1];
}
int ans = 1;
for(int len = n / 2 - 300; len <= n / 2 + 300; len++){
if (len <= 1 or len > n) continue;
LL target = 1LL * len * len;
for(int i = 1; i + len - 1 <= n; i++){
if (target == s[i + len - 1] - s[i - 1]){
ans += 1;
}
}
}
cout << ans << '\n';
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
2 3 2 1 3 5 3 4 2 5 1
output:
2 2
result:
ok 2 number(s): "2 2"
Test #2:
score: 0
Accepted
time: 51ms
memory: 3932kb
input:
32 9811 3756 4960 5623 8471 9330 2388 7066 5434 4707 1711 2109 7274 9630 5057 6390 3252 2632 2291 4697 1923 6423 369 2430 2586 549 1344 1518 9170 268 1315 8808 4843 4603 532 2210 275 835 9059 8529 3449 1412 6071 6737 6944 788 8202 6684 6926 1729 7530 6506 9781 5523 5864 7067 9398 3446 2044 2578 2530...
output:
2 1 1 3 1 4 2 2 2 1 3 2 3 4 2 3 1 1 2 2 2 2 2 1 1 2 1 1 3 2 1 1
result:
ok 32 numbers
Test #3:
score: 0
Accepted
time: 54ms
memory: 4780kb
input:
30 197277 196178 84300 27937 106346 19833 131659 146010 164112 125344 93600 5183 26597 55011 30797 100914 95876 43674 164981 46730 54589 170497 74527 174820 95270 4993 78003 192129 55163 191465 156865 7654 164216 22085 118048 86126 178144 77067 60852 180286 180626 3165 43878 111790 131714 96251 9864...
output:
3 2 4 3 1 1 2 1 1 1 2 2 4 2 2 1 3 2 3 5 2 2 2 3 1 2 2 3 3 3
result:
ok 30 numbers
Test #4:
score: 0
Accepted
time: 54ms
memory: 4644kb
input:
1 200000 137314 193717 79689 175047 84798 4387 143791 85750 74947 54899 184128 11640 65653 28078 162472 26557 67059 131134 76117 106373 112748 129954 162927 153580 108335 90723 55445 10637 129723 50828 49548 181363 173509 114849 139837 78161 184622 85313 149952 137930 3981 20555 35145 188575 101906 ...
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 0
Accepted
time: 52ms
memory: 3632kb
input:
133 1614 1272 303 1151 1402 1380 1564 1048 654 1493 994 1243 972 1437 617 940 458 1220 1597 889 60 3 1420 478 1396 905 528 332 1552 45 1548 503 703 1070 2 770 1413 472 400 1011 584 771 542 1588 1529 566 1467 364 216 835 1035 1462 555 1503 1001 304 378 762 732 948 476 10 799 908 620 295 249 439 718 9...
output:
2 3 2 2 2 2 1 1 2 2 2 1 1 2 1 1 2 2 3 2 2 1 3 2 2 3 2 1 1 3 1 1 2 3 1 3 1 1 1 1 1 1 3 6 6 3 2 1 1 2 2 3 2 3 3 3 2 1 1 3 1 1 2 2 3 1 2 2 1 3 2 4 4 2 2 2 1 1 3 2 2 2 3 3 1 1 1 2 1 3 1 2 2 3 4 6 2 1 4 3 1 2 2 2 1 1 1 2 2 1 2 2 2 2 3 3 1 1 1 1 3 1 2 3 2 1 3 2 2 4 3 1 3
result:
ok 133 numbers
Test #6:
score: -100
Wrong Answer
time: 49ms
memory: 3636kb
input:
135 1434 226 580 497 715 1367 589 298 216 1027 982 1307 231 306 1084 627 752 490 684 481 500 354 1346 1353 1028 473 457 991 1283 264 235 1045 1308 970 209 971 1197 1191 204 572 735 1280 1246 523 1103 384 757 1272 639 618 1372 50 16 335 599 1219 1284 449 840 1140 416 91 1407 868 1420 317 1385 119 170...
output:
4 1 2 2 3 1 3 3 2 2 2 2 1 1 1 2 1 1 1 4 1 2 2 2 3 2 1 2 1 2 1 4 1 1 1 2 2 4 3 1 1 1 2 3 1 1 1 3 1 1 1 2 2 3 1 2 1 2 1 3 2 1 1 1 3 1 2 2 1 2 2 4 2 1 2 1 2 2 1 3 2 1 2 2 2 2 3 1 2 1 1 2 1 4 1 3 2 1 2 2 1 3 2 1 3 1 1 1 3 1 2 1 2 1 2 2 3 1 2 2 2 1 1 1 1 2 2 2 2 1 2 2 1 4 3
result:
wrong answer 6th numbers differ - expected: '2', found: '1'