結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 13:51:50 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 886 bytes |
| コンパイル時間 | 2,593 ms |
| コンパイル使用メモリ | 197,240 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:52:01 |
| 合計ジャッジ時間 | 3,216 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
return x < y ? (x = y, true) : false;
}
struct io_setup {
io_setup() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
}
} io_setup;
void solve() {
int n;
cin >> n;
vector<int> l(n), r(n);
rep(i, 0, n) cin >> l[i] >> r[i];
vector<int> p(n);
iota(p.begin(), p.end(), 0);
int ans = 0;
do {
int x = -1;
for (int i : p) {
chmax(x, l[i]);
if (x > r[i]) {
x = -1;
break;
}
}
if (x != -1) ans++;
} while (next_permutation(p.begin(), p.end()));
cout << ans << "\n";
}
int main() {
int t = 1;
// cin >> t;
while (t--) solve();
}