結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 13:31:32 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 393 bytes |
| コンパイル時間 | 620 ms |
| コンパイル使用メモリ | 63,496 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:31:42 |
| 合計ジャッジ時間 | 1,699 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include<iostream>
#include<cassert>
using namespace std;
int N,L[8],R[8];
int dp[1<<8];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
for(int i=0;i<N;i++)cin>>L[i]>>R[i];
dp[0]=1;
for(int i=0;i<1<<N;i++)
{
int Lm=0;
for(int j=0;j<N;j++)if(i>>j&1)Lm=max(Lm,L[j]);
for(int j=0;j<N;j++)if(!(i>>j&1)&&Lm<=R[j])dp[i|1<<j]+=dp[i];
}
cout<<dp[(1<<N)-1]<<endl;
}