QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#818706#9248. An Easy Math ProblemZawos#WA 519ms4168kbC++231.3kb2024-12-18 04:50:262024-12-18 04:50:27

Judging History

This is the latest submission verdict.

  • [2024-12-18 04:50:27]
  • Judged
  • Verdict: WA
  • Time: 519ms
  • Memory: 4168kb
  • [2024-12-18 04:50:26]
  • Submitted

answer

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
using namespace __gnu_pbds;
using ll=long long;
using ld=long double;
using vi=vector<int>;
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
//上
const ll N  = 1e5+5;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int q;
    cin >> q;
    vector<ll> primes(N,1);
    vector<ll> red;
    for(ll i = 2; i < N;i++){
        if(primes[i]){
            red.push_back(i);
        for(ll j = i* i; j < N; j+=i){
            primes[j] = 0;
        }
        }
    }
    for(int i = 0; i < q; i++){
        ll x;
        cin >> x;
        ll sq = 0;
        for(ll i = 1; i* i <= x;i++){
            if(x%(i*i) == 0)sq++;
        }
        map<ll,ll> mp;
        for(auto &u: red){
            if(x %u == 0){
                x/=u;
                mp[u]++;
            }
        }
        if(x > 1)mp[x]++;
        ll mul = 1;
        for(auto &u: mp){
            mul *= (u.second+2)*(u.second+1)/2;
        }
        mul -=sq;
        mul/=2;
        mul+=1;
        cout<<mul<<'\n';
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 4164kb

input:

10
1
2
3
4
5
6
7
8
9
10

output:

1
2
2
3
2
5
2
4
3
5

result:

ok 10 lines

Test #2:

score: 0
Accepted
time: 519ms
memory: 4168kb

input:

2000
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
6469693230
646969323...

output:

29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
29525
...

result:

ok 2000 lines

Test #3:

score: -100
Wrong Answer
time: 305ms
memory: 4164kb

input:

2000
1763047095
79735483
1016286871
2864801397
2327774116
2668010360
3469893354
3634459021
1613699068
781737219
574741575
2763134701
1458502604
1822260248
2281150332
2924219311
2493931196
3735904708
158802001
2006921221
729928782
1974841034
727412600
2873393292
1291087179
2741607663
1893408215
29827...

output:

14
5
2
5
13
121
40
14
4
81
119
14
13
13
12
41
4
4
14
2
729
41
120
120
13
41
14
5
14
41
14
243
41
14
4
364
5
12
12
361
2
14
364
243
14
121
2
122
40
40
41
41
5
27
14
13
5
5
14
122
13
243
729
13
41
122
2
14
40
2
81
41
121
14
120
41
40
13
13
14
13
14
4
5
5
5
40
81
122
118
363
5
41
41
14
2
14
14
5
2
122
...

result:

wrong answer 5th lines differ - expected: '23', found: '13'