結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-08-18 13:27:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,019 bytes |
コンパイル時間 | 4,980 ms |
コンパイル使用メモリ | 334,992 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-08-18 13:27:31 |
合計ジャッジ時間 | 6,137 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#if __has_include(<yoniha/all.h>) #include <yoniha/all.h> using namespace atcoder; #else #include <bits/stdc++.h> #if __has_include(<atcoder/all>) #include <atcoder/all> using namespace atcoder; #endif #endif using namespace std; #define int long long #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = (int)((n) - 1); i >= 0; i--) template <typename T> bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;} template <typename T> bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} // using mint = modint; signed main(){ int n; cin >> n; vector<pair<int, int>> lr(n); for(auto&& [l, r] : lr) cin >> l >> r; vector<int> per(n); rep(i, n) per.at(i) = i; int ans = 0; do{ bool ok = true; int before = -1; rep(i, n){ auto [l, r] = lr.at(per.at(i)); ok &= r >= before; before = max(l, before); } ans += ok; }while(next_permutation(all(per))); cout << ans << '\n'; }