結果
問題 | No.2142 Segment Zero |
ユーザー | ゾビオ |
提出日時 | 2022-12-02 22:53:25 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,328 bytes |
コンパイル時間 | 5,899 ms |
コンパイル使用メモリ | 307,820 KB |
実行使用メモリ | 11,240 KB |
最終ジャッジ日時 | 2024-10-10 01:22:04 |
合計ジャッジ時間 | 7,363 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 6 ms
11,028 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 | - |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> // AtCoder using namespace std; using namespace atcoder; // AtCoder using uint = unsigned int; using ll = long long; using ull = unsigned long long; using ld = long double; using mint = modint998244353; // AtCoder using vll = vector<long long>; using vvll = vector<vector<long long>>; using vvvll = vector<vector<vector<long long>>>; using vvvvll = vector<vector<vector<vector<long long>>>>; using dll = deque<long long>; using ddll = deque<deque<long long>>; using dddll = deque<deque<deque<long long>>>; using ddddll = deque<deque<deque<deque<long long>>>>; using pll = pair<long long, long long>; using vpll = vector<pair<long long, long long>>; using vvpll = vector<vector<pair<long long, long long>>>; #define rep(i, n) for (long long i = 0; i < n; i++) #define reps(i, n) for (long long i = 1; i <= n; i++) #define rrep(i, n) for (long long i = n - 1; i >= 0; i--) #define rreps(i, n) for (long long i = n; i >= 1; i--) #define reep(i, a, b) for (long long i = a; i < b; i++) #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define PI acos(-1.0) #define YES printf("Yes\n"), exit(0) #define NO printf("No\n"), exit(0) constexpr long long MOD = 998244353LL; constexpr long long INF = (1LL << 60); template<class T> void setcout(T n) {cout << setprecision(n) << fixed;} template<class T> void arrcout(T &a) { for(size_t i = 0; i < a.size(); i++) cout << (i ? " " : "") << a.at(i); cout << endl; } template<class T> void arrcout2(T &a) { for(size_t i = 0; i < a.size(); i++) { for(size_t j = 0; j < a[i].size(); j++) cout << (j ? " " : "") << a.at(i).at(j); cout << endl;} } template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; } template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; } //#pragma GCC target("avx2") //#pragma GCC optimize("O3") //#pragma GCC optimize("unroll-loops") int main() { ll n, k; cin >> n >> k; if(k == n * (n + 1) / 2) cout << 0 << endl, exit(0); vll rui(n + 2); reps(i, n) rui[i + 1] = rui[i] + i; ll l = 0, r = n + 1; while(r - l > 1) { ll mid = l + r >> 1; if(rui.back() - mid * (mid + 1) / 2 <= k) r = mid; //Σ(mid+1)~Nがk以下 else l = mid; } r++; cout << 1 + (r != n) + (k - (rui.back() - (r - 1) * r / 2) > 1) << endl; }