結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-09-06 14:10:29 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 811 bytes |
コンパイル時間 | 3,589 ms |
コンパイル使用メモリ | 276,088 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 14:10:34 |
合計ジャッジ時間 | 4,657 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #ifdef LOCAL #include <debug.hpp> #else #define debug(...) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); 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> perm(N); iota(perm.begin(), perm.end(), 0); do { // この順列に対して, 条件を満たす難易度が存在するか bool ok = true; int pre = -1; for (int i = 0; i < N; i++) { if (pre > R[perm[i]]) ok = false; pre = max(pre, L[perm[i]]); } if (ok) ans++; } while (next_permutation(perm.begin(), perm.end())); cout << ans << "\n"; }