/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 344.0 KiB
#2 Accepted 4ms 532.0 KiB
#3 Time Exceeded ≥1098ms ≥572.0 KiB
#4 Time Exceeded ≥1099ms ≥564.0 KiB

Code

#pragma GCC optimize("O3,unroll-loops")
#include<bits/stdc++.h>
using namespace std;

#define fastio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long


void solve() {
       
      int n ;
      cin >> n ;
      int ans = 0 ;
      for(int i = 1 ; i <= n ; i ++) {
        int l = i ;
        // increse jab tak value n / i hai 
        // val = n / i 
        // n / k = val 
        // k = n / val ;
        int val = n / i ;
        int r = n / val ;
        ans += (val - 1) * (r - l + 1) ;
        i = r ;
      }
      cout << ans << endl ;
}









int32_t main() {

    fastio();
    int t = 1;
    cin >> t;
    while (t--) solve();
}

Information

Submit By
Type
Submission
Problem
P1207 D2. GCD equal Absolute Value (Hard Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 16:58:54
Judged At
2025-07-14 16:58:54
Judged By
Score
5
Total Time
≥1099ms
Peak Memory
≥572.0 KiB