結果
問題 |
No.921 ずんだアロー
|
ユーザー |
|
提出日時 | 2020-03-29 13:42:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 754 bytes |
コンパイル時間 | 1,755 ms |
コンパイル使用メモリ | 165,296 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 13:25:09 |
合計ジャッジ時間 | 3,721 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 6 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<n;i++) using namespace std; typedef long long ll; typedef pair<int,int> P; const int INF = 1e9; const int MOD = 1000000007; int main(){ int n; cin >> n; vector<int> a(n); rep(i,n) cin >> a[i]; int ans = 0; vector<P> k = {P(a[0],0)}; rep(i,n){ if(k.back().first == a[i]){ k.back().second ++; }else{ k.emplace_back(P(a[i],1)); } } bool ok = true; for(P p:k){ if(p.second > 1) ans += p.second - 1; else{ if(ok){ ans ++; ok = false; }else{ ok = true; } } } cout << ans << endl; return 0; }