結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-09-11 00:04:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 2,824 ms |
コンパイル使用メモリ | 281,024 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-11 00:04:30 |
合計ジャッジ時間 | 4,276 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector<pair<int, int>> v(n); rep(i, n) cin >> v[i].first >> v[i].second; int ans = 0; vector<int> p(n); iota(p.begin(), p.end(), 0); do { bool ok = true; int maxim = 0; rep(i, n - 1) { maxim = max(maxim, v[p[i]].first); if (maxim > v[p[i + 1]].second) ok = false; } if (ok) ans++; } while (next_permutation(p.begin(), p.end())); cout << ans << '\n'; return 0; }