結果
| 問題 | No.648 お や す み |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-12 10:09:03 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 2,000 ms |
| + 472µs | |
| コード長 | 544 bytes |
| 記録 | |
| コンパイル時間 | 2,035 ms |
| コンパイル使用メモリ | 329,544 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-14 16:28:14 |
| 合計ジャッジ時間 | 5,120 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 84 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long ll;
#define int long long
int n;
void solved() {
cin >> n;
int l = 1, r = 2e9;
while (l < r) {
int x = (l + r) >> 1;
if ((1 + x) * x / 2 >= n)
r = x;
else
l = x + 1;
}
if ((1 + l) * l / 2 != n)
cout << "NO" << endl;
else {
cout << "YES" << endl;
cout << l << endl;
}
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
/*int t = 1;
cin >> t;
while (t--)*/
solved();
return 0;
}