結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー 小高悠太郎
提出日時 2025-09-11 18:36:55
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 706 bytes
コンパイル時間 6,504 ms
コンパイル使用メモリ 259,512 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-09-11 18:37:03
合計ジャッジ時間 7,917 ms
ジャッジサーバーID
(参考情報)
judge / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); ++i)
#define repi(i, a, b) for (int i = (a); i < (b); ++i)
#define all(x) (x).begin(), (x).end()
#define fore(i, a) for(auto &i:a)
using ll = long long;
#define DEBUG(x) cerr << #x << ": "; for (auto _ : x) cerr << _ << " "; cerr << endl;
int main() {
	int n;cin >> n;
	vector<int> L(n), R(n), order(n);
	rep(i, n)cin >> L[i] >> R[i];
	rep(i, n)order[i] = i;
	int ans = 0;
	do{
		bool flag = true;
		int maxl = -1;
		rep(i, n-1){
      maxl = max(maxl, L[order[i]]);
			if(maxl > R[order[i+1]])flag = false;
		}
		if(flag)ans++;
	}while(next_permutation(all(order)));
	cout << ans << endl;

}
0