結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
|
提出日時 | 2025-09-06 14:49:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 2,610 ms |
コンパイル使用メモリ | 215,936 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 14:49:45 |
合計ジャッジ時間 | 3,174 ms |
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define rep(i, a, n) for (int i = a; i < (int)(n); i++) using ll = long long; int main() { int n; cin >> n; vector<int> l(n), r(n); rep(i, 0, n) cin >> l[i] >> r[i]; vector<int> p(n); iota(p.begin(), p.end(), 0); int ans = 0; do { int pre_diff = l[p[0]]; bool ok = true; rep(i, 1, n) { if (r[p[i]] < pre_diff) { ok = false; break; } else if (i != n - 1) { pre_diff = max(pre_diff, l[p[i]]); } } ans += ok; } while (next_permutation(p.begin(), p.end())); cout << ans << endl; }