結果

問題 No.1162 Many Quotients hard
ユーザー Jikky1618
提出日時 2025-06-29 08:35:39
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 474 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 3,233 ms
コンパイル使用メモリ 281,144 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-29 08:35:50
合計ジャッジ時間 10,372 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#ifdef LOCAL
#include <debug.hpp>
#else
#define debug(...)
#endif

vector<tuple<ll, ll, ll>> quotient_ranges(ll n) {
    vector<tuple<ll, ll, ll>> res;
    ll k = 1;
    while (k * k <= n) k++;
    for (ll i = 1; i <= n / k; i++) {
        res.emplace_back(i, n / (i + 1) + 1, n / i + 1);
    }
    for (ll i = k - 1; i >= 1; i--) {
        res.emplace_back(n / i, i, i + 1);
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll N;
    cin >> N;
    ll k = 1;
    while (k * k <= N) k++;
    ll ans = (N / k) + (k - 1);
    cout << ans << '\n';
}
0