Submission #3791922


Source Code Expand

#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e9;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  int ans = 0;
  rep(i, n - 1) if (a[i] != -1 && a[i] == a[i + 1]) {
    ans++;
    a[i + 1] = -1;
  }
  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task A - Colorful Slimes 2
User fuu32
Language C++14 (GCC 5.4.1)
Score 200
Code Size 867 Byte
Status AC
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 13
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All example_0, example_1, example_2, example_3, handmade_0, handmade_1, rand_0, rand_1, smallcolor_0, smallcolor_1, smallcolor_2, smallcolor_3, smallcolor_4
Case Name Status Exec Time Memory
example_0 AC 1 ms 256 KB
example_1 AC 1 ms 256 KB
example_2 AC 1 ms 256 KB
example_3 AC 1 ms 256 KB
handmade_0 AC 1 ms 256 KB
handmade_1 AC 1 ms 256 KB
rand_0 AC 1 ms 256 KB
rand_1 AC 1 ms 256 KB
smallcolor_0 AC 1 ms 256 KB
smallcolor_1 AC 2 ms 256 KB
smallcolor_2 AC 1 ms 256 KB
smallcolor_3 AC 1 ms 256 KB
smallcolor_4 AC 1 ms 256 KB