結果
問題 | No.648 お や す み |
ユーザー |
![]() |
提出日時 | 2018-04-05 17:33:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 731 bytes |
コンパイル時間 | 1,619 ms |
コンパイル使用メモリ | 167,048 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 10:37:15 |
合計ジャッジ時間 | 3,707 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 WA * 41 |
ソースコード
#include <bits/stdc++.h>const int MOD = 1e9 + 7;const int iINF = 1000000000;const long long int llINF = 1000000000000000000;const double PI = acos(-1.0);#define rep(i, n) for (int i = 0; i < (n); i++)using namespace std;using ll = long long int;using P = pair<int, int>;using edge = struct{int to;int cost;};int dx[4] = {1, 0, -1, 0};int dy[4] = {0, 1, 0, -1};ll N;bool check(ll t){return N <= t * (t + 1) / 2;}int main(){cin >> N;ll ng = 0, ok = 1e9;while(ok - ng > 1){ll mid = (ng + ok) / 2;(check(mid) ? ok : ng) = mid;}if(ok == 1e9)cout << "NO" << endl;elsecout << "YES\n" << ok << endl;return 0;}