QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#791228#9248. An Easy Math ProblemzhishengTL 399ms5684kbC++201.2kb2024-11-28 17:34:592024-11-28 17:34:59

Judging History

This is the latest submission verdict.

  • [2024-11-28 17:34:59]
  • Judged
  • Verdict: TL
  • Time: 399ms
  • Memory: 5684kb
  • [2024-11-28 17:34:59]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
    ios::sync_with_stdio(0),cin.tie(0);
    map <int,int> mp;
    auto solve = [&]() {
        int n;
        cin >> n;
        if(mp[n]) {
            cout << mp[n] << "\n";
            return;
        }
        int tmp = n;
        vector <int> a;
        for(int i=1;i*i<=tmp;i++) {
            if(tmp%i==0) {
                a.push_back(i);
                if(i!=tmp/i) {
                    a.push_back(tmp/i);
                }
            }

        }

        sort(a.begin(),a.end());
        // for(auto i : a) {
        //     cout << i << " ";
        // }
        // cout << "\n";
        set <pair<int,int>> st;
        for(int i=0;i<a.size();i++) {
            for(int j=i;j<a.size();j++) {
                int x = a[i];int y = a[j];
                st.insert({x/__gcd(x,y),y/__gcd(x,y)});
            }
        }
        // for(auto [x,y] : st) {
        //     cout << x << " " << y << "\n";
        // }
        mp[n] = st.size();
        cout << st.size() << "\n";


    };
    int t;
    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: 3860kb

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: 85ms
memory: 5684kb

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: 0
Accepted
time: 399ms
memory: 4196kb

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
23
95
68
14
8
68
203
14
23
32
38
41
8
8
14
2
608
41
158
338
23
41
14
5
14
41
14
203
41
14
17
446
5
53
59
878
2
14
365
203
14
203
2
122
32
95
41
41
5
23
14
41
5
5
14
122
23
203
608
23
41
122
2
14
95
2
68
41
203
14
230
41
68
23
50
14
32
14
8
5
5
5
68
68
122
293
473
5
41
41
14
2
14
14
5
2
122
...

result:

ok 2000 lines

Extra Test:

score: -3
Extra Test Failed : Time Limit Exceeded on 3

input:

2000
10000000000
9999999800
9999999600
9999999400
9999999200
9999999000
9999998800
9999998600
9999998400
9999998200
9999998000
9999997800
9999997600
9999997400
9999997200
9999997000
9999996800
9999996600
9999996400
9999996200
9999996000
9999995800
9999995600
9999995400
9999995200
9999995000
99999948...

output:


result: