結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 13:22:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,155 bytes |
| コンパイル時間 | 1,941 ms |
| コンパイル使用メモリ | 200,952 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:22:57 |
| 合計ジャッジ時間 | 2,999 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/lazysegtree>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll LINF = 3001001001001001001;
const int MOD = 998244353;
const string Yes = "Yes";
const string No = "No";
#define reps(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) reps(i, 0, n)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template <typename T> istream &operator>>(istream &is, vector<T> &v) {for (T &in : v)is >> in;return is;}
vector<pair<int,int>> dir = {{0,1},{1,0},{0,-1},{-1,0},};
int main() {
int n;cin>>n;
vector<int> l(n),r(n);
rep(i,n) cin>>l.at(i)>>r.at(i);
vector<int> ord(n);
rep(i,n) ord.at(i) = i;
int ans = 0;
do {
bool ok = true;
int cur = 0;
for(auto i : ord) {
if(cur>r.at(i)) {
ok = false;
}
cur = max(cur,l.at(i));
}
ans += !!ok;
} while(next_permutation(all(ord)));
cout << ans << endl;
return 0;
}