提出 #24537970


ソースコード 拡げる

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#else
    //    freopen("lupa.in","r",stdin);
    //    freopen("pupa.out","w",stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << setprecision(10);
    cout << fixed;
    int n, k;
    cin >> n >> k;
    vector<int> vars(n, k);
    for (int ii = 0; ii < k; ++ii) {
        char ch;
        int idx;
        cin >> ch >> idx;
        idx--;
        if (ch == 'L') {
            for (int i = 0; i < idx; ++i) {
                vars[i]--;
            }
            vars[idx] = 0;
        } else {
            for (int i = idx+1; i < n; ++i) {
                vars[i]--;
            }
            vars[idx] = 0;
        }
    }
    ll ans = 1;
    for(int i =0;i <n;++i) {
        if (vars[i] > 0) {
            ans *= vars[i];
            ans %= 998244353;
        }
    }
    cout << ans;
    return 0;
}

提出情報

提出日時
問題 A - LR Constraints
ユーザ Paliukh
言語 C++ (GCC 9.2.1)
得点 300
コード長 1116 Byte
結果 AC
実行時間 8 ms
メモリ 3640 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 2
AC × 17
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 8 ms 3500 KiB
random_02.txt AC 2 ms 3640 KiB
random_03.txt AC 2 ms 3608 KiB
random_04.txt AC 2 ms 3640 KiB
random_05.txt AC 3 ms 3456 KiB
random_06.txt AC 2 ms 3572 KiB
random_07.txt AC 3 ms 3576 KiB
random_08.txt AC 3 ms 3552 KiB
random_09.txt AC 2 ms 3552 KiB
random_10.txt AC 2 ms 3576 KiB
random_11.txt AC 2 ms 3616 KiB
random_12.txt AC 2 ms 3580 KiB
random_13.txt AC 2 ms 3556 KiB
random_14.txt AC 2 ms 3580 KiB
random_15.txt AC 2 ms 3568 KiB
sample_01.txt AC 2 ms 3560 KiB
sample_02.txt AC 3 ms 3568 KiB