Submission #1245416


Source Code Expand

#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

int main() {
    string s;
    cin >> s;
    int pos = 0;
    int cnt = 0;
    REP(i,1,s.size()) {
        if (s[i-1] != s[i]) {
            pos = i;
            ++cnt;
        }
    }
    cout << cnt << endl;
    
    return 0;
}

Submission Info

Submission Time
Task C - 1D Reversi
User unsre
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1525 Byte
Status AC
Exec Time 4 ms
Memory 512 KB

Judge Result

Set Name sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
sample sample_01.txt, sample_02.txt, sample_03.txt
All alternate_01.txt, alternate_02.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, same_01.txt, same_02.txt, sample_01.txt, sample_02.txt, sample_03.txt, small_01.txt, small_02.txt, small_03.txt
Case Name Status Exec Time Memory
alternate_01.txt AC 4 ms 512 KB
alternate_02.txt AC 4 ms 512 KB
random_01.txt AC 4 ms 512 KB
random_02.txt AC 4 ms 512 KB
random_03.txt AC 4 ms 512 KB
random_04.txt AC 4 ms 512 KB
random_05.txt AC 4 ms 512 KB
same_01.txt AC 4 ms 512 KB
same_02.txt AC 4 ms 512 KB
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
small_01.txt AC 1 ms 256 KB
small_02.txt AC 1 ms 256 KB
small_03.txt AC 1 ms 256 KB