結果
| 問題 | No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 19:07:44 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| + 764µs | |
| コード長 | 693 bytes |
| 記録 | |
| コンパイル時間 | 2,007 ms |
| コンパイル使用メモリ | 333,140 KB |
| 実行使用メモリ | 9,400 KB |
| 最終ジャッジ日時 | 2026-07-14 21:43:11 |
| 合計ジャッジ時間 | 3,317 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)(s); i < (int)(e); ++i)
#define all(a) (a).begin(),(a).end()
int main() {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
int N;
cin >> N;
vector<int> L(N), R(N);
rep(i, 0, N) cin >> L[i] >> R[i];
vector<int> P(N);
rep(i, 0, N) P[i] = i;
int ans = 0;
do {
int t = 0;
bool can = true;
rep(i, 0, N) {
if (R[P[i]] < t) can = false;
else t = max(t, L[P[i]]);
}
if (can) ++ans;
} while (next_permutation(all(P)));
cout << ans << '\n';
}