結果
問題 |
No.921 ずんだアロー
|
ユーザー |
![]() |
提出日時 | 2020-04-29 12:55:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 634 bytes |
コンパイル時間 | 1,954 ms |
コンパイル使用メモリ | 168,136 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 02:33:00 |
合計ジャッジ時間 | 2,662 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=(0);i<(n);i++) using namespace std; typedef long long ll; typedef pair<ll, ll> pll; int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; vector<ll> a(n); rep(i, n) cin >> a[i]; int ans = 0; int t = 1; bool zun = true; rep(i, n - 1){ if(zun){ if(a[i] == a[i+1]) { t++; }else{ zun = false; } }else{ t++; zun = true; } } ans = max(ans, t); t = 0; zun = false; rep(i, n - 1){ if(zun){ if(a[i] == a[i+1]) { t++; }else{ zun = false; } }else{ t++; zun = true; } } cout << ans << endl; }