結果
| 問題 |
No.360 増加門松列
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-05-29 17:17:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 864 bytes |
| コンパイル時間 | 1,531 ms |
| コンパイル使用メモリ | 80,772 KB |
| 最終ジャッジ日時 | 2025-01-10 16:13:49 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 9 |
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
void solve() {
std::vector<int> xs(7);
for (auto& x : xs) std::cin >> x;
std::sort(xs.begin(), xs.end());
do {
bool judge = true;
for (int i = 0; i + 3 <= 7; ++i) {
std::vector<int> ys;
for (int j = 0; j < 3; ++j) {
ys.push_back(xs[i + j]);
}
std::sort(ys.begin(), ys.end());
ys.erase(std::unique(ys.begin(), ys.end()), ys.end());
if (ys.size() < 3 || xs[i + 1] == ys[1]) judge = false;
}
if (judge) {
std::cout << "YES\n";
return;
}
} while (std::next_permutation(xs.begin(), xs.end()));
std::cout << "NO\n";
}
int main() {
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
solve();
return 0;
}