結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
hen
|
| 提出日時 | 2025-09-06 13:36:41 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 2,097 bytes |
| コンパイル時間 | 4,496 ms |
| コンパイル使用メモリ | 253,724 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 13:37:18 |
| 合計ジャッジ時間 | 5,389 ms |
|
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#ifndef ONLINE_JUDGE
#define _GLIBCXX_DEBUG
#endif
using ull = unsigned long long;
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
#define rep(i,n) for(ll i = 0; i< (int)n; i++)
#define drep(i,n) for(ll i=n; i>=0; i--)
#define REP(a,b,c) for(ll a = b; a<c; a++)
#define DREP(a,b,c) for(ll a = b; a>=c; a--)
const ll INF = 5e18;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define em emplace
#define pob pop_back
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define fail cout << -1 << endl
#define YN {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;} // if(bool) YN; みたいに
template<class... T> inline void input(T&... a) { ((cin >> a), ...);}
template<class T> inline void print(vector<T>& a) {rep(i,a.size()) if(i) cout << " " << a[i]; else cout << a[i]; cout << endl;}
template<class T> inline bool chmin(T& a, T b) {if(a>b) {a=b; return true;} else return false;}
template<class T> inline bool chmax(T& a, T b) {if(a<b) {a=b; return true;} else return false;}
vi DY = {1,0,-1,0,1,-1,-1,1};
vi DX = {0,1,0,-1,1,1,-1,-1};
// cout << fixed << setprecision(20);
using mint = modint1000000007;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n; input(n);
vi l(n),r(n); rep(i,n) input(l[i],r[i]);
vi p;
if(n==7) p = {0,1,2,3,4,5,6};
else p = {0,1,2,3,4,5,6,7};
int cnt = 0;
do {
int now = l[p[0]];
bool check = true;
for(int i=1; i<n; i++) {
if(now<l[p[i]]) now = l[p[i]];
else if(now <= r[p[i]]) chmin(now,r[p[i]]);
else check = false;
}
if(check) cnt++;
} while(next_permutation(all(p)));
cout << cnt << endl;
}
hen