/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Time Exceeded ≥1099ms ≥560.0 KiB
#3 Time Exceeded ≥1099ms ≥532.0 KiB

Code

#include <bits/stdc++.h>
#define ll long long int
#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define eb emplace_back
#define popb pop_back
#define popf pop_front
#define ff first
#define ss second
#define here cout<<"HERE !!!"<<endl;
#define sz(v) (ll)v.size()
#define vi vector<ll>
#define print(v) for (auto it : v) cout << it << " "; cout << endl;
#define all(v) v.begin(), v.end()
#define read(v) for(auto &it:v) cin>>it;
#define Faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
using namespace  __gnu_pbds;
using namespace std;
const long double pi = acos(-1.0l);
const ll inf = 1e18;
const int mod = 998244353, mx = 1e6 + 5;
//rotate(v.begin(), v.begin() + d, v.end());
//order_of_key(k): number of element less than k
//find_by_order(k): k-th element in set start from 0
void ravana(ll idx)
{

    ll n;   cin >> n;
    ll cnt = 0;
    for (ll i = 1; i <= n; i++)
    {
        for (ll j = i + i;j <= n; j += i)
        {
            cnt++;
        }
    }
    // for(ll i=4;i<=n)
    // bool done[n + 1] = {false};
    // ll cnt = n - 1;
    // for (ll i = n; i >= 1; i--)
    // {
    //     if (done[i])
    //         continue;
    //     done[i] = true;
    //     ll x = i;
    //     while (x % 2 == 0)
    //     {
    //         x /= 2;
    //         cnt++;
    //         done[x] = 1;

    //     }
    // }

    cout << cnt << endl;







    // string s;   cin >> s;
    // map<char, ll>mp;
    // for (auto it : s)
    // {
    //     mp[it]++;
    // }
    // ll balance = 0;
    // ll mx = 0;
    // for (auto it : mp)
    // {
    //     balance += it.ss;
    //     mx = max(mx, it.ss);
    // }
    // balance -= 2 * mx;
    // balance = abs(balance);
    // if (balance > 1)
    // {

    //     cout << -1 << endl;
    //     return;
    // }
    // if (sz(s) == 1)
    // {
    //     print(s);
    // }
    // for (char i = 'a'; i <= 'a'; i++)
    // {

    //     for (char j = 'b'; j <= 'b'; j++)
    //     {
    //         vector<char>v;
    //         if (i == j)
    //             continue;
    //         multiset<char>ms;
    //         for (auto it : s)
    //             ms.insert(it);
    //         ll cnti = mp[i];
    //         ll cntj = mp[j];

    //         while (cnti > 0 and cntj > 0)
    //         {
    //             ms.erase(ms.find(i));
    //             ms.erase(ms.find(j));
    //             v.pb(i);
    //             v.pb(j);
    //             cnti--;
    //             cntj--;
    //         }
    //         print(v);
    //         // cout<<cnti<<" "<<cntj<<endl;
    //         while (cnti > 0 and sz(ms))
    //         {
    //             if (v.back() == i)
    //             {
    //                 if (i != *ms.begin())
    //                 {
    //                     v.pb(*ms.begin());
    //                     ms.erase(ms.begin());
    //                 }
    //                 else
    //                 {
    //                     auto it = ms.upper_bound(i);
    //                     v.pb(*it);
    //                     ms.erase(ms.find(*it));
    //                 }
    //             }
    //             else
    //             {
    //                 cnti--;
    //                 v.pb(i);
    //                 ms.erase(ms.find(i));
    //             }
    //         }
    //         print(v);
    //         while (cntj > 0 and sz(ms))
    //         {
    //             if (v.back() == j)
    //             {
    //                 if (j != *ms.begin())
    //                 {
    //                     v.pb(*ms.begin());
    //                     ms.erase(ms.begin());
    //                 }
    //                 else
    //                 {
    //                     auto it = ms.upper_bound(j);
    //                     v.pb(*it);
    //                     ms.erase(ms.find(*it));
    //                 }
    //             }
    //             else
    //             {
    //                 cntj--;
    //                 v.pb(j);
    //                 ms.erase(ms.find(j));
    //             }
    //         }
    //         print(ms);
    //         bool f = false;
    //         while (sz(ms))
    //         {
    //             if (*ms.begin() != v.back())
    //             {
    //                 v.pb(*ms.begin());
    //                 ms.erase(ms.begin());
    //             }
    //             else
    //             {
    //                 auto it = ms.upper_bound(v.back());
    //                 if(it==ms.end())
    //                 {

    //                 }
    //                 ms.erase(ms.find(*it));
    //                 v.pb(*it);
    //             }
    //         }

    //         // for (ll i = 0; i + 1 < sz(s); i++)
    //         // {
    //         //     if (v[i] == v[i + 1])
    //         //     {
    //         //         f = true;
    //         //         break;
    //         //     }
    //         // }
    //         // //print(v);
    //         // if (f)
    //         //     continue;
    //         // for (auto it : v)
    //         //     cout << it;
    //         // cout << endl;
    //         // return;
    //     }
    // }
    // cout << -1 << endl;

}
signed main()
{
    auto begin = std::chrono::high_resolution_clock::now();
    Faster;
    //pre();
    ll t = 1;
    cin >> t;
    for (ll i = 1; i <= t; ++i)
    {
        ravana(i);
    }
    auto end = std::chrono::high_resolution_clock::now();
    auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
    cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n";
    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 17:32:26
Judged At
2025-07-14 17:32:26
Judged By
Score
0
Total Time
≥1099ms
Peak Memory
≥560.0 KiB