結果

問題 No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
ユーザー D M
提出日時 2025-09-08 16:25:16
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 721 bytes
コンパイル時間 6,270 ms
コンパイル使用メモリ 334,216 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-09-08 16:25:24
合計ジャッジ時間 7,418 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
const ll MOD = 998244353;
#include<atcoder/all>
using namespace atcoder;
using mint = modint998244353;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;cin>>n;
  vector<vector<ll>> A(n,vector<ll>(3));
  rep(i,n){
    cin>>A[i][0]>>A[i][1];
    A[i][2]=i;
  }
  sort(all(A));
  ll ans=0;
  do{
    ll base=0;
    bool f=true;
    for(auto I:A){
        if(base>I[1]){
            f=false;
            break;
        }else{
            base=max(base,I[0]);
        }
    }
    ans+=f;
  }while(next_permutation(all(A)));
  cout<<ans<<endl;
}
0