結果
問題 |
No.2343 (l+r)/2
|
ユーザー |
|
提出日時 | 2023-06-09 23:20:20 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 745 bytes |
コンパイル時間 | 3,976 ms |
コンパイル使用メモリ | 280,048 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2025-01-02 05:26:57 |
合計ジャッジ時間 | 5,020 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 7 WA * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:19: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | for (scanf("%d", &TestCase); TestCase--;) { | ~~~~~^~~~~~~~~~~~~~~~~ main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:15:39: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | for (int &x : a) scanf("%d", &x); | ~~~~~^~~~~~~~~~
ソースコード
#include <bits/stdc++.h> using ll = long long; using uint = unsigned; using namespace std; const int mxn = 2e5 + 10; int TestCase, f[mxn][3]; signed main() { for (scanf("%d", &TestCase); TestCase--;) { int n; scanf("%d", &n); vector<int> a(n); for (int &x : a) scanf("%d", &x); vector<bool> tag; int last = a[0], len = 0; a.push_back(-1); for (int i = 0; i <= n; ++i) { if (a[i] == last) ++len; else { tag.push_back(len > 1); last = a[i], len = 1; } } auto solve = [&]() { // printf("size = %d\n", (int)tag.size()); if (tag.size() % 2 == 0) return puts("Yes"); for (int i = 1; i < (int)tag.size(); i += 2) if (tag[i]) return puts("Yes"); return puts("No"); }; solve(); } return 0; }