結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー dice360
提出日時 2025-09-06 13:21:35
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 6,232 ms
コンパイル使用メモリ 212,720 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-06 13:22:00
合計ジャッジ時間 7,178 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N;
    cin >> N;
    vector<int> L(N), R(N);
    for (int i = 0; i < N; ++i)
        cin >> L[i] >> R[i];
    int ans = 0;
    vector<int> p(N);
    iota(p.begin(), p.end(), 0);
    do
    {
        int point = 0;
        bool check = true;
        for (int i = 0; i < N; ++i)
        {
            if (R[p[i]] < point)
                check = false;
            point = max(point, L[p[i]]);
        }
        if (check)
            ans++;
    } while (next_permutation(p.begin(), p.end()));
    cout << ans << endl;
    return 0;
}
0