結果

問題 No.921 ずんだアロー
ユーザー sigma425sigma425
提出日時 2019-11-09 10:09:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,161 bytes
コンパイル時間 2,085 ms
コンパイル使用メモリ 202,736 KB
実行使用メモリ 4,356 KB
最終ジャッジ日時 2023-10-13 06:59:13
合計ジャッジ時間 3,565 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 1 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 27 ms
4,348 KB
testcase_11 AC 28 ms
4,348 KB
testcase_12 AC 7 ms
4,352 KB
testcase_13 AC 20 ms
4,352 KB
testcase_14 AC 24 ms
4,352 KB
testcase_15 AC 14 ms
4,348 KB
testcase_16 AC 4 ms
4,352 KB
testcase_17 AC 23 ms
4,348 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 28 ms
4,348 KB
testcase_24 AC 27 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif
int main(){
	int N;cin >> N;
	using P = pair<int,int>;
	V<P> v;
	rep(i,N){
		int x; cin >> x;
		if(v.empty() || v.back().fs != x) v.pb(P(x,1));
		else v.back().sc++;
	}
	int K = v.size();
	int a = 0,b = 0;
	rep(i,K){
		int x = v[i].sc;
		int na = b + x;
		int nb = max(a,b);
		a=na,b=nb;
	}
	cout << max(a,b) << endl;
}
0