/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 9ms 360.0 KiB
#3 Time Exceeded ≥1099ms ≥564.0 KiB
#4 Time Exceeded ≥1100ms ≥556.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; 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++17 (G++ 13.2.0)
Submit At
2025-07-31 06:18:18
Judged At
2025-07-31 06:18:18
Judged By
Score
5
Total Time
≥1100ms
Peak Memory
≥564.0 KiB