QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725024#9231. Random NumbersOkuchiri#WA 394ms3808kbC++20628b2024-11-08 15:56:062024-11-08 15:56:08

Judging History

你现在查看的是最新测评结果

  • [2024-11-08 15:56:08]
  • 评测
  • 测评结果:WA
  • 用时:394ms
  • 内存:3808kb
  • [2024-11-08 15:56:06]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll n,a[200010],ans;
ll q[200010];
void solve()
{
    ans=0;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        q[i]=q[i-1]+a[i];
    }
    for(ll len=1;len<=min(3000ll,n);len++)
    {
        for(ll l=1;l+len-1<=n;l++)
        {
            ll r=l+len-1;
            if(q[r]-q[l-1]==len*len)ans++;
        }
    }
    cout<<ans<<'\n';
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll T = 1;
    cin >> T;
    while(T--)
    {
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 394ms
memory: 3808kb

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
3
1
4
2
2
1
1
1
1
3
1
1
3
1
1
1
1
2
1
2
1
1
1
1
1
3
1
1
1

result:

wrong answer 1st numbers differ - expected: '2', found: '1'