/ SeriousOJ /

Record Detail

Time Exceeded


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

Code

#include <bits/stdc++.h>

using namespace std;

int32_t main() {
  cin.tie(0) -> sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int x = n, d = 1;
    int64_t ans = 0;
    while (d <= n) { 
      int nxt = n / (n / d);
      ans += (n / d) * 1LL * (nxt - d + 1);
      d = nxt + 1;
    }
    cout << ans - n << "\n";
  }
  return 0;
}

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 17:53:13
Judged At
2025-07-14 17:53:13
Judged By
Score
5
Total Time
≥1099ms
Peak Memory
≥572.0 KiB