結果
| 問題 |
No.3262 水色コーダーさん、その問題d問題ですよ?(1<=d<=N)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-06 14:12:19 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 1,891 bytes |
| コンパイル時間 | 966 ms |
| コンパイル使用メモリ | 98,180 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-06 14:12:21 |
| 合計ジャッジ時間 | 1,764 ms |
|
ジャッジサーバーID (参考情報) |
judge / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 24 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;
struct Func_print
{
void is_true(bool yes) {
cout << (yes ? "Yes" : "No") << '\n';
};
void print_v_str(vector<string> v) {
for (auto s : v) {
for (auto c : s) {
cout << c << ' ';
}
cout << '\n';
}
}
void print_vv(vector<vector<int>> vv) {
for (auto v : vv) {
for (auto d : v) {
cout << d << ' ';
}
cout << '\n';
}
}
};
Func_print Out;//出力用
#define REP(i, n) for (int i = 0; i < (n); i++)
#define VEC(type, name, n) vector<type> name(n); REP(i, n) cin >> name.at(i)
#define VV(type, name, h, w) vector<vector<type>> name(h, vector<type>(w)); REP(i, h) REP(j, w) cin >> name.at(i).at(j)
#define ALL(iterable) begin(iterable), end(iterable)
int main() {
///////////////////////////////
//お約束
ios::sync_with_stdio(false);//printfとcoutを混在しないように注意
//doubleの桁数指定は以下を使用する
//cout << fixed << setprecision() << y << endl;
cin.tie(nullptr);
////////////////////////////////
int N; cin >> N;
vector<pair<int, int>> lr;
REP(i, N) {
int l, r; cin >> l >> r;
lr.emplace_back(l, r);
}
vector<int> index(N);
REP(i, N) index[i] = i;
int ans = 0;
do{
bool success = true;
int score_now = 0;
REP(i, N) {
auto [l, r] = lr[index[i]];
if (score_now > r) {
success = false;
break;
}
score_now = max(score_now, l);
}
if (success) {
ans ++;
}
}while (next_permutation(ALL(index)));
cout << ans << endl;
}