結果
問題 | No.853 河原の石 |
ユーザー | kotamanegi |
提出日時 | 2019-07-26 22:05:05 |
言語 | C++17(clang) (17.0.6 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,928 bytes |
コンパイル時間 | 9,080 ms |
コンパイル使用メモリ | 149,384 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-30 14:24:30 |
合計ジャッジ時間 | 3,495 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 1 ms
5,248 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | WA | - |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | WA | - |
testcase_53 | WA | - |
testcase_54 | AC | 1 ms
5,248 KB |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
ソースコード
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <algorithm> #include <utility> #include <functional> #include <cstring> #include <queue> #include <stack> #include <math.h> #include <iterator> #include <vector> #include <string> #include <set> #include <math.h> #include <iostream> #include <random> #include<map> #include <iomanip> #include <time.h> #include <stdlib.h> #include <list> #include <typeinfo> #include <list> #include <set> #include <cassert> #include<fstream> #include <unordered_map> #include <cstdlib> #include <complex> #include <cctype> #include <bitset> using namespace std; typedef string::const_iterator State; #define Ma_PI 3.141592653589793 #define eps 0.00000001 #define LONG_INF 1e18 #define GOLD 1.61803398874989484820458 #define MAX_MOD 1000000007 #define MOD 998244353 #define seg_size 262144 #define REP(a,b) for(long long a = 0;a < b;++a) vector<complex<double>> DFT(vector<complex<double>> a) { int n = a.size(); if (n == 1) return a; vector<complex<double>> a0(n / 2), a1(n / 2); REP(i, n) { if (i % 2 == 0) { a0[i / 2] = a[i]; } else { a1[i / 2] = a[i]; } } vector<complex<double>> inversed_a0 = DFT(a0), inversed_a1 = DFT(a1); vector<complex<double>> inversed_a(n); for (int i = 0; i < n; ++i) { complex<double> zeta = complex<double>(cos(2 * Ma_PI * i / n), sin(2 * Ma_PI * i / n)); inversed_a[i] = inversed_a0[i % (n / 2)] + zeta * inversed_a1[i % (n / 2)]; } return inversed_a; } vector<complex<double>> IDFT(vector<complex<double>> inversed_a) { int n = inversed_a.size(); vector<complex<double>> now = DFT(inversed_a); reverse(now.begin(), now.end()); for (int q = now.size() - 1; q >= 1; --q) { swap(now[q], now[q - 1]); } REP(i, n) { now[i] /= complex<double>(n, 0); } return now; } vector<complex<double>> conv(vector<complex<double>> a, vector<complex<double>> b) { int deg = a.size() + b.size() - 1; int n = 1; while (n < deg) n <<= 1; a.resize(n); b.resize(n); vector<complex<double>> inversed_a = DFT(a), inversed_b = DFT(b); vector<complex<double>> inversed_c(n); REP(i, n) { inversed_c[i] = inversed_a[i] * inversed_b[i]; } return IDFT(inversed_c); } long long inv(long long now) { long long hoge = MOD - 2LL; long long ans = 1; while (hoge != 0) { if (hoge % 2 == 1) { ans *= now; ans %= MOD; } hoge /= 2; now *= now; now %= MOD; } return ans; } int main(){ long long h, w; cin >> h >> w; w = llabs(w); long long back = 1; long long ans = 0; while (h != 1) { long long bot = 1; long long top = h; while (llabs(top - bot) > 1) { long long mid = (top + bot) / 2LL; long long value = (w + mid - 1LL) / mid; if (value <= back) { top = mid; } else { bot = mid; } } long long next_diff = h - bot; ans += next_diff * (back); if (bot == 1) break; back = (w + (bot - 1LL) - 1LL) / (bot - 1LL); h = bot; } ans += w; cout << ans << endl; return 0; }