結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
|
提出日時 | 2025-09-06 14:23:41 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 842 bytes |
コンパイル時間 | 3,700 ms |
コンパイル使用メモリ | 280,480 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 14:23:52 |
合計ジャッジ時間 | 4,671 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 WA * 1 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define ALL(a) (a).begin(), (a).end() #define Yes cout << "Yes" << endl #define No cout << "No" << endl #define endl '\n' int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector<pair<int, int>> P(N); for (int i = 0; i < N; i++) { int l, r; cin >> l >> r; P[i] = {l, r}; } int ans = 0; sort(ALL(P)); do { bool ok = true; int cur_dif = 0; for (int i = 0; i < N; i++) { ll need = max(P[i].first, cur_dif); if (need > P[i].second) { ok = false; break; } cur_dif = need; } if (ok) ans++; } while (next_permutation(ALL(P))); cout << ans << endl; }