QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#595388#9245. Bracket SequenceDBsoleil#WA 1ms4392kbC++20784b2024-09-28 13:36:132024-09-28 13:36:14

Judging History

This is the latest submission verdict.

  • [2024-09-28 13:36:14]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 4392kb
  • [2024-09-28 13:36:13]
  • Submitted

answer

#include<bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;

const int N=1e5+5;
int T,isp[N];
ll n;
vector<ll> pr;

void sieve(int n)
{
    for(int i=2;i<=n;i++)
    {
        if(!isp[i]) pr.pb(i);
        for(ll p:pr)
        {
            if(p*i>n) break;
            isp[p*i]=1;
            if(i%p==0) break;
        }
    }
    //cerr<<pr.size();
}

ll work(ll n)
{
    if(n==1) return 1;
    ll ans=1;
    for(int p:pr)
    {
        int cnt=0;
        while(n%p==0) n/=p,cnt++;
        ans*=(cnt+cnt+1);
    }
    if(n!=1) ans*=3;
    return (ans+1)/2;
}

void solve()
{
    scanf("%lld",&n);
    printf("%lld\n",work(n));
}

int main()
{
    sieve(1e5);
    scanf("%d",&T);
    while(T--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 4392kb

input:

5 20
(()()
1 1 2 1
1 1 3 1
1 1 4 1
1 1 5 1
1 2 3 1
1 2 4 1
1 2 5 1
1 3 4 1
1 3 5 1
1 4 5 1
2 1 3 1
2 1 4 1
2 1 5 1
2 2 3 1
2 2 4 1
2 2 5 1
2 3 5 1
2 4 5 1
1 1 5 2
2 1 5 2

output:

8
8
8
8
8

result:

wrong answer 1st lines differ - expected: '0', found: '8'