/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Time Exceeded ≥1101ms ≥15.0 MiB
#3 Time Exceeded ≥1094ms ≥8.168 MiB

Code

/*
    JAI JAGANNATH!
*/
//@Author : zanj0

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

template <class T>
using ordered_set = __gnu_pbds::tree<T, __gnu_pbds::null_type, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;


#define ff first
#define ss second
#define pb push_back
#define MOD 1000000007
#define inf 1e18
#define ps(x, y) fixed << setprecision(y) << x
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)
#define endl "\n"
#define timetaken cerr << "Time : " << 1000 * (long double)clock() / (long double)CLOCKS_PER_SEC << "ms\n"

typedef long long int lli;

void zanj0()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
#endif
}
lli n;
void Brute()
{
    lli ret = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = i; j <= n; j++)
        {
            lli g = gcd(i, j);
            if (g == abs(i - j))
            {
                cout << i << " " << j << endl;
                ret++;
            }
        }
    }
    cout << ret << endl;
}
void Out(vector<lli> &v)
{
    for (auto &it : v)
    {
        cout << it << " ";
    }
    cout << endl;
}
void Solve()
{
    cin >> n;
    vector<lli> cnt(n + 1);
    for (lli i = 1; i <= n; i++)
    {
if (i + i > n)
                break;
        for (lli j = i; j <= n; j += i)
        {
            if (i + j > n)
                break;
            cnt[j]++;
        }
    }
    // Out(cnt);
    lli ret = 0;
    for (auto &it : cnt)
        ret += it;
        
    cout << ret << endl;
}
int32_t main()
{
    zanj0();
    w(t) Solve();
    timetaken;
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1206 D1. GCD equal Absolute Value (Easy Version)
Contest
Educational Round 1
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-14 16:13:08
Judged At
2025-07-14 16:13:08
Judged By
Score
0
Total Time
≥1101ms
Peak Memory
≥15.0 MiB