結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
![]() |
提出日時 | 2025-09-07 15:04:40 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 764 bytes |
コンパイル時間 | 3,180 ms |
コンパイル使用メモリ | 279,768 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-09-07 15:04:45 |
合計ジャッジ時間 | 4,498 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 FOR(i,a,b) for(ll i = a; i < (ll)(b); i++) #define all(a) (a).begin(),(a).end() using ll = long long; using VI = vector<int>; using P = pair<int,int>; const long long INF = 1LL << 60; const int DX[] = {1,0,-1,0}; const int DY[] = {0,1,0,-1}; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); ll n; cin >> n; vector<ll> l(n),r(n); rep(i,n) cin >> l[i] >> r[i]; vector<int> a(n); iota(all(a),0); ll ans = 0; do{ vector<ll> b(n); b[0] = l[a[0]]; ans++; for(int i = 1; i < n; i++){ if(b[i-1] > r[a[i]]) {ans--; break;} b[i] = max(l[a[i]],b[i-1]); } }while(next_permutation(all(a))); cout << ans << endl; return 0; }