結果

問題 No.2539 スライムゲーム
ユーザー 👑 hitonanodehitonanode
提出日時 2023-11-10 23:10:25
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 981 bytes
コンパイル時間 920 ms
コンパイル使用メモリ 88,808 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2023-11-10 23:10:27
合計ジャッジ時間 2,292 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    string s;
    cin >> s;

    vector<long long> st{0};

    bool is_inf = false;
    constexpr long long thres = 1000000000000000000LL;

    for (int i = (int)s.size() - 1; i >= 0; --i) {
        if (s.at(i) == '(') {
            if (st.size() == 1) {
                st.back() += 1;
                break;
            }
            auto v = st.back();
            st.pop_back();
            if (v >= 60) {
                is_inf = true;
                v = 0;
            }
            st.back() += 1LL << v;
            if (st.back() > thres) {
                is_inf = true;
                st.back() = 0;
            }
        } else {
            st.push_back(0);
        }
    }

    auto ret = st.front();
    if (ret > thres) is_inf = true;

    if (is_inf) {
        puts("INFTY");
    } else {
        cout << ret << endl;
    }
}
0