結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー DeltaStruct
提出日時 2025-08-18 11:23:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 1,542 ms
コンパイル使用メモリ 198,136 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-18 13:22:40
合計ジャッジ時間 2,419 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
	int n,r(0); cin >> n; vector<pair<int,int>> A(n); for (auto& [a,b]:A) cin >> a >> b ;
	vector<int> B(n); iota(B.begin(),B.end(),0);
	do {
		int x = 0,rr = 1;
		for (int i:B){
			x = max(x,A[i].first);
			if (x>A[i].second) rr = 0;
		}
		r += rr;
	} while(next_permutation(B.begin(),B.end()));
	cout << r << endl;
}
0