結果
問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
ユーザー |
|
提出日時 | 2025-09-06 13:17:11 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 597 bytes |
コンパイル時間 | 2,847 ms |
コンパイル使用メモリ | 278,556 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-09-06 13:18:23 |
合計ジャッジ時間 | 4,017 ms |
ジャッジサーバーID (参考情報) |
judge / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 24 |
ソースコード
#include <bits/stdc++.h> #include <cstdlib> #include <math.h> using namespace std; using ll = long long; int main(){ int n; cin >> n; vector<int>l(n),r(n); vector<int>p(n); for(int i=0;i<n;i++){ cin >> l[i] >> r[i]; p[i]=i; } int ans=0; do{ int x=0; bool ok=true; for(int i=0;i<n;i++){ if(x>r[p[i]]){ ok=false; break; } x=max(x,l[p[i]]); } ans+=ok; }while(next_permutation(p.begin(),p.end())); cout << ans << endl; return 0; }