結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
コンテスト
ユーザー srjywrdnprkt
提出日時 2025-10-20 15:58:53
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 651 bytes
コンパイル時間 3,219 ms
コンパイル使用メモリ 277,844 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-10-20 15:58:59
合計ジャッジ時間 4,521 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
//#include <atcoder/modint>

using namespace std;
//using namespace atcoder;
using ll = long long;
//using mint = modint998244353;

int main(){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int N, ans=0;
    cin >> N;
    vector<int> idx(N), L(N), R(N);
    for (int i=0; i<N; i++){
        cin >> L[i] >> R[i];
        idx[i] = i;
    }
    do{
        int now=0;
        bool ok=1;
        for (auto i : idx){
            if (R[i] < now) ok=0;
            now = max(L[i], now);
        }
        ans += ok;
    } while(next_permutation(idx.begin(), idx.end()));

    cout << ans << endl;

    return 0;
}
0