結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
Akidai
|
| 提出日時 | 2025-09-06 13:56:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 1,375 bytes |
| コンパイル時間 | 3,897 ms |
| コンパイル使用メモリ | 253,512 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2025-09-06 13:56:12 |
| 合計ジャッジ時間 | 5,008 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = (1LL << 62) - (1LL << 31) - 1;
#define REP(i, init, n) for(int i = (int)(init); i < (int)(n); i++)
#define RREP(i, init, n) for(int i = (int)(init); i >= (int)(n); i--)
#define All(A) A.begin(), A.end()
#define rAll(A) A.rbegin(), A.rend()
#define vi vector<int>
#define vl vector<long>
#define vvi vector<vector<int>>
#define vvl vector<vector<long>>
#define pint pair<int, int>
#define plong pair<long, long>
int N;
vector<pint> P;
void solve() {
vi ord(N);
iota(All(ord), 0);
int ans = 0;
do {
bool ok = true;
REP(i, 0, N - 1) {
int pl = P[ord[i]].first;
REP(j, i + 1, N) {
int nr = P[ord[j]].second;
if(nr < pl) ok = false;
}
}
if(ok) {
/*
REP(i, 0, N) {
cerr << P[ord[i]].first << " " << P[ord[i]].second << endl;
}
cerr << "-----" << endl;
*/
ans++;
}
} while(next_permutation(All(ord)));
cout << ans << endl;
}
int main() {
cin.tie(nullptr);
ios::sync_with_stdio(false);
cin >> N;
P.resize(N);
REP(i, 0, N) cin >> P[i].first >> P[i].second;
solve();
}
Akidai