結果

問題 No.1162 Many Quotients hard
ユーザー a01sa01to
提出日時 2024-11-09 00:38:16
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 1,214 bytes
コンパイル時間 3,254 ms
コンパイル使用メモリ 248,692 KB
実行使用メモリ 795,216 KB
最終ジャッジ日時 2024-11-09 00:38:24
合計ジャッジ時間 7,605 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 2
other AC * 21 MLE * 1 -- * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#line 1 "main.cpp"
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using ull = unsigned long long;
#line 2 "my-library\\library\\math\\quotient.hpp"
#include <concepts>
#line 6 "my-library\\library\\math\\quotient.hpp"
using namespace std;
namespace asalib {
  namespace math {
    template<integral T>
    constexpr vector<tuple<T, T, T>> floor_quotient(T n) {
      vector<tuple<T, T, T>> res;
      for (T i = 1; i <= n; ++i) {
        T v = n / i;
        res.push_back({ v, i, n / v });
        i = n / v;
      }
      return res;
    }
    template<integral T>
    constexpr vector<tuple<T, T, T>> ceil_quotient(T n) {
      vector<tuple<T, T, T>> res;
      for (T i = 1; i <= n; ++i) {
        T v = (n + i - 1) / i;
        if (i == n) {
          assert(v == 1);
          res.push_back({ v, i, i });
        }
        else {
          assert(v > 1);
          T j = (n + v - 2) / (v - 1) - 1;
          res.push_back({ v, i, j });
          i = j;
        }
      }
      return res;
    }
  }
}
#line 8 "main.cpp"
int main() {
  ll n;
  cin >> n;
  auto v = asalib::math::floor_quotient(n);
  cout << v.size() << endl;
  return 0;
}
0