結果

問題 No.921 ずんだアロー
ユーザー tonyu0tonyu0
提出日時 2019-11-08 22:18:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 92,348 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-15 01:35:11
合計ジャッジ時間 2,085 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <iomanip>
#include <cmath>
#include <map>
using namespace std;
using ll = long long;

int main()
{
  int N; cin >> N;
  vector<ll> A(N); for(int i = 0; i < N; ++i) cin >> A[i];
  bool black = true;
  ll ans = 0;
  for(int i = 0; i < N; ++i) {
    if(black) {
      ++ans;
      while(A[i] == A[i+1]) {
        ++i; ++ans;
      }
      black = false;
    } else {
      black = true;
    }
  }
  cout << ans << endl;
  return 0;
}
0