/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 3ms 484.0 KiB
#3 Time Exceeded ≥1100ms ≥764.0 KiB
#4 Time Exceeded ≥1100ms ≥560.0 KiB

Code

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

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    int tc; cin >> tc;

    test:
    while (tc--) {
        ll n; cin >> n;
        
        ll totalNod = 0;
        for (ll left = 1, right = 0; left <= n; left = right+1) {
            ll temp = n/left;
            right = n/temp;
            ll aa = ((right-left+1) * temp);
            totalNod = (totalNod + aa);
        }

        cout << totalNod-n << "\n";
    }
}

Information

Submit By
Type
Submission
Problem
P1207 D2. GCD equal Absolute Value (Hard Version)
Language
C++11 (G++ 13.2.0)
Submit At
2025-07-31 06:32:32
Judged At
2025-07-31 06:32:32
Judged By
Score
5
Total Time
≥1100ms
Peak Memory
≥764.0 KiB