結果

問題 No.2142 Segment Zero
ユーザー US_cubeUS_cube
提出日時 2022-12-02 21:51:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,368 bytes
コンパイル時間 683 ms
コンパイル使用メモリ 95,140 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-18 05:45:37
合計ジャッジ時間 1,909 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 12 ms
5,376 KB
testcase_02 WA -
testcase_03 AC 1 ms
5,376 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 WA -
testcase_09 AC 4 ms
5,376 KB
testcase_10 AC 11 ms
5,376 KB
testcase_11 AC 11 ms
5,376 KB
testcase_12 AC 12 ms
5,376 KB
testcase_13 AC 12 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 12 ms
5,376 KB
testcase_16 WA -
testcase_17 AC 10 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 8 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 9 ms
5,376 KB
testcase_23 AC 4 ms
5,376 KB
testcase_24 AC 4 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 5 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 6 ms
5,376 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 3 ms
5,376 KB
testcase_33 AC 3 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <climits>
#include <functional>
#include <cassert>
#include <numeric>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define per(i, n) for(int i = (n) - 1; i >= 0; i--)
using ll = long long;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
constexpr int mod = 1000000007;
using namespace std;
template<class T, class U>
bool chmax(T &a, const U &b){ return a < b ? (a = b, 1) : 0; }
template<class T, class U>
bool chmin(T &a, const U &b){ return a > b ? (a = b, 1) : 0; }
int main(){
  ll n,K;
  cin >> n >> K;
  K = n*(n+1)/2 - K;
  for(ll i = 1; i <= n; i++){ // length
    const ll v = K - i*(i-1)/2;
    if(v % i == 0 && 1 <= v/i && v/i <= n-i){
      cout << "1\n";
      return 0;
    }
  }
  K = n*(n+1)/2 - K;
  for(ll i = 1; i <= n; i++){
    const ll v = K - i*(i-1)/2;
    if(v % i == 0 && 1 <= v/i && v/i <= n-i){
      cout << "2\n";
      return 0;
    }
  }
}
0