結果
| 問題 | No.3611 Omega Cat(Judging ver.) |
| コンテスト | |
| ユーザー |
kwm_t
|
| 提出日時 | 2026-08-07 23:58:22 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 43 ms / 2,000 ms |
| + 991µs | |
| コード長 | 2,549 bytes |
| 記録 | |
| コンパイル時間 | 2,136 ms |
| コンパイル使用メモリ | 336,856 KB |
| 実行使用メモリ | 7,064 KB |
| 最終ジャッジ日時 | 2026-08-07 23:58:32 |
| 合計ジャッジ時間 | 4,990 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_1 |
(要ログイン)
| サブタスク | 配点 | 結果 |
|---|---|---|
| サンプル | 0 % | AC * 1 |
| 小課題1 | 20 % | AC * 6 |
| 小課題2 | 40 % | AC * 19 |
| 小課題3 | 40 % | AC * 33 |
| 合計 | 1.5 * 100% = 150 点 |
ソースコード
#include <bits/stdc++.h>
//#include <atcoder/all>
using namespace std;
// using namespace atcoder;
// using mint = modint1000000007;
// const int mod = 1000000007;
// using mint = modint998244353;
// const int mod = 998244353;
// const int INF = 1e9;
// const long long LINF = 1e18;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep2(i, l, r) for (int i = (l); i < (r); ++i)
#define rrep(i, n) for (int i = (n)-1; i >= 0; --i)
#define rrep2(i, l, r) for (int i = (r)-1; i >= (l); --i)
#define all(x) (x).begin(), (x).end()
#define allR(x) (x).rbegin(), (x).rend()
#define P pair<int, int>
template<typename A, typename B> inline bool chmax(A& a, const B& b) { if (a < b) { a = b; return true; } return false; }
template<typename A, typename B> inline bool chmin(A& a, const B& b) { if (a > b) { a = b; return true; } return false; }
#ifndef KWM_T_ALGORITHM_RUN_LENGTH_ENCODING_HPP
#define KWM_T_ALGORITHM_RUN_LENGTH_ENCODING_HPP
#include <vector>
#include <utility>
#include <iterator>
namespace kwm_t::algorithm {
/**
* @brief Run Length Encoding(連長圧縮)
*
* 任意の forward iterator に対して適用可能
*
* 計算量:
* O(N)
*
* 制約:
* - 要素型に == が定義されていること
* verified
* https://atcoder.jp/contests/abc452/submissions/74695137
* https://atcoder.jp/contests/awc0051/submissions/75170743
*/
template<class It>
std::vector<std::pair<typename std::iterator_traits<It>::value_type, int>>
run_length_encoding(It first, It last) {
using T = typename std::iterator_traits<It>::value_type;
std::vector<std::pair<T, int>> ret;
if (first == last) return ret;
It it = first;
while (it != last) {
It jt = it;
int cnt = 0;
while (jt != last && *jt == *it) {
++jt;
++cnt;
}
ret.emplace_back(*it, cnt);
it = jt;
}
return ret;
}
// コンテナ版
template<class Container>
std::vector<std::pair<typename Container::value_type, int>>
run_length_encoding(const Container& c) {
return run_length_encoding(c.begin(), c.end());
}
} // namespace kwm_t::algorithm
#endif // KWM_T_ALGORITHM_RUN_LENGTH_ENCODING_HPP
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<int>h(n);
rep(i, n)cin >> h[i];
vector<int>v;
rep(i, n - 1) {
if (h[i] < h[i + 1])v.push_back(0);
else v.push_back(1);
}
// 111000111000
auto l = kwm_t::algorithm::run_length_encoding(v);
if (l.size() == 4 && l[0].first == 1)cout << "Yes" << endl;
else cout << "No" << endl;
}
return 0;
}
kwm_t