結果
| 問題 |
No.1366 交換門松列・梅
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-02-06 13:58:44 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 1,476 bytes |
| コンパイル時間 | 1,859 ms |
| コンパイル使用メモリ | 198,344 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2025-06-20 11:18:24 |
| 合計ジャッジ時間 | 2,477 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 13 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG_
#include <compe/debug.hpp>
#else
#define dump(...)
#endif
#define FastIO cin.tie(nullptr), ios_base::sync_with_stdio(false);
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define output(msg) cout << (msg) << '\n'
#define die(msg) \
do { \
cout << msg << endl; \
exit(0); \
} while (0)
#define all(k) k.begin(), k.end()
#define rall(k) k.rbegin(), k.rend()
#define INFi 1 << 30
#define INFll 1LL << 60
template <typename T> bool chmax(T& a, const T& b) {
return ((a < b) ? (a = b, true) : (false));
}
template <typename T> bool chmin(T& a, const T& b) {
return ((a > b) ? (a = b, true) : false);
}
using llint = long long int;
bool check(vector<int> ai) {
if (ai[1] < ai[0] && ai[0] < ai[2]) return true;
if (ai[1] < ai[2] && ai[2] < ai[0]) return true;
if (ai[1] > ai[0] && ai[0] > ai[2]) return true;
if (ai[1] > ai[2] && ai[2] > ai[0]) return true;
return false;
}
bool is_kadomatsu(vector<int> ai, vector<int> bi, int a, int b) {
int tmp = ai[a];
ai[a] = bi[b];
bi[b] = tmp;
return check(ai) && check(bi);
}
int main() {
FastIO;
vector<int> ai(3), bi(3);
rep(i, 3) cin >> ai[i];
rep(i, 3) cin >> bi[i];
bool can_kadomatsu{false};
rep(i, 3) {
rep(j, 3) {
if (is_kadomatsu(ai, bi, i, j)) {
can_kadomatsu = true;
}
}
}
if (can_kadomatsu)
output("Yes");
else
output("No");
}