結果
| 問題 | No.2142 Segment Zero |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-12-03 01:47:39 |
| 言語 | C++17 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 3 ms / 2,000 ms |
| + 919µs | |
| コード長 | 517 bytes |
| 記録 | |
| コンパイル時間 | 1,247 ms |
| コンパイル使用メモリ | 211,644 KB |
| 実行使用メモリ | 9,920 KB |
| 最終ジャッジ日時 | 2026-10-16 16:20:42 |
| 合計ジャッジ時間 | 3,290 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 36 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
ll N, K;
cin >> N >> K;
K = (N * (N + 1)) / 2 - K;
K *= 2;
for (ll x = 1; x * x <= K; x ++) {
if (K % x) {
continue;
}
ll y = K / x;
if ((x + y) % 2 == 0) {
continue;
}
ll a = (y + (x - 1)) / 2, b = (y - (x - 1)) / 2;
if (1 <= b && a <= N) {
cout << 1 << endl;
return 0;
}
}
cout << 2 << endl;
}