結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-09-07 04:18:58 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 1,088 bytes |
コンパイル時間 | 3,378 ms |
コンパイル使用メモリ | 277,988 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-07 04:19:02 |
合計ジャッジ時間 | 4,694 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(int)n; i++) #define repi(i,m,n) for(int i=(int)m; i<=(int)n; i++) #define rrep(i,n) for(int i=(int)n-1; i>=0; i--) #define rrepi(i,m,n) for(int i=(int)n; i>=(int)m; i--) #define all(x) x.begin(),x.end() template <typename T> inline bool chmin(T& a, const T& b) { return a > b ? a = b, true : false; }; template <typename T> inline bool chmax(T& a, const T& b) { return a < b ? a = b, true : false; }; template <typename T> void uniq(std::vector<T> &v){ std::sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end()); } using ll = long long; int main(){ int n; cin >> n; vector<int> l(n),r(n); rep(i,n) cin >> l[i] >> r[i]; vector<int> ord(n); iota(all(ord), 0); ll ans = 0; do{ bool f = true; int pre = l[ord[0]]; rep(i,n-1){ f &= (r[ord[i+1]] >= pre); chmax(pre, l[ord[i+1]]); } if(f) ans++; }while(next_permutation(all(ord))); cout << ans << endl; return 0; }