QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#648457 | #9231. Random Numbers | ucup-team963# | WA | 43ms | 3716kb | C++14 | 568b | 2024-10-17 19:04:54 | 2024-10-17 19:04:56 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
using ll = long long;
const int N = 2e5 + 10;
ll a[N];
signed main() {
int T;
cin >> T;
while(T --) {
int n;
cin >> n;
rep(i,1,n) cin >> a[i];
rep(i,1,n) a[i] += a[i - 1];
ll cnt = 0;
rep(l,1,n) rep(r,l,min(l+100,n)) {
if(a[r] - a[l - 1] == 1ll * (r - l + 1) * (r - l + 1)) {
++ cnt;
}
}
cout << cnt << endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
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: -100
Wrong Answer
time: 43ms
memory: 3716kb
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:
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:
wrong answer 1st numbers differ - expected: '2', found: '1'