結果

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

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>

using namespace std;
using namespace atcoder;

using ll = long long;
using ld = long double;

ll INF = 2e18;

template<typename T> using vc = vector<T>;
template<typename T> using vv = vc<vc<T>>;

#define MP(a, b) make_pair(a, b)
#define nfor(i,s,n) for(ll i=s;i<(ll)n;i++)
#define rep(i,n) for(ll i = 0; i < (n); i++)

using vl = vc<ll>; using vvl = vv<ll>; using vvvl = vv<vl>; using vvvvl = vv<vvl>;
using vs = vc<string>; using vvs = vv<string>;
using vb = vc<bool>; using vvb = vv<bool>; using vvvb = vv<vb>;
using vld = vc<ld>; using vvld = vv<ld>; using vvvld = vv<vld>;
using P = pair<ll, ll>;
template<class T>istream& operator>>(istream& i, vc<T>& v) { rep(j, size(v))i >> v[j]; return i; }
template<class T> using pq = priority_queue<T, vc<T>>;//大きい順
template<class T> using pq_g = priority_queue<T, vc<T>, greater<T>>;//小さい順


#define pb push_back
#define pob pop_back
#define all(s) s.begin(),s.end()
#define YES std::cout<<"Yes"<<std::endl
#define NO std::cout<<"No"<<std::endl
#define YN {std::cout<<"Yes"<<std::endl;}else{std::cout<<"No"<<std::endl;}
#define dame std::cout<<-1<<std::endl
#define pop_cnt(s) ll(popcount(uint64_t(s)))
#define yu_qurid(x,y) ((x)*(x)+(y)*(y))
#define mannhattan(x1,x2,y1,y2) (abs(x1-x2)+abs(y1-y2))
#define vc_cout(v){ll n = size(v);rep(i,n)std::cout<<v[i]<<std::endl;}
#define vv_cout(v){ll n = size(v);rep(i,n){rep(j,size(v[i])){std::cout<<v[i][j]<<' ';}std::cout<<std::endl;}}
using mint = atcoder::modint998244353;
// using mint = atcoder::modint1000000007;
using vm = vc<mint>;
using vvm = vc<vm>;

int main(){
    ll n;
    cin >> n;
    vc<P> v(n);
    rep(i, n) cin >> v[i].first >> v[i].second;
    sort(all(v));
    ll ans = 0;
    do{
        ll cur = 0;
        bool f = true;
        rep(i, n){
            if(v[i].second < cur){
                f = false;
                break;
            }
            cur = max(cur, v[i].first);
        }
        if(f) ans++;
    }while(next_permutation(all(v)));
    cout << ans << endl;
}
0