結果
問題 | No.360 増加門松列 |
ユーザー |
|
提出日時 | 2020-05-29 17:19:15 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 886 bytes |
コンパイル時間 | 1,157 ms |
コンパイル使用メモリ | 80,132 KB |
最終ジャッジ日時 | 2025-01-10 16:13:55 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
#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] || xs[i] >= xs[i + 2]) 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;}