Submission #3426880
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define why(n,x) int n;while(cin >>n,n!=x)
#define iFOR(i,x,n)for(int i=x;i<n;i++)
#define unless(flg) if ( !(flg) )
#define read cin<<
#define echo cout<<
#define fin <<'\n'
#define __ <<" "<<
#define bash push_back
#define alles(x) x.begin(),x.end()
#define SWAP(a,b) ((a != b) && (a += b,b = a - b,a -= b))
int dx[]={1,0,-1,0,1,1,-1,-1};
int dy[]={0,-1,0,1,-1,1,-1,1};
const int INF=1 << 30;
bool inside(int x,int y,int w,int h){
return (x>=0 && y>=0 && x<w && y<h);}
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vit;
typedef map<string,int> mstit;
typedef priority_queue<int> pqit;
int main(){
cin.tie(0), ios::sync_with_stdio(false);
string str;
cin >>str;
int a=0,siz=str.length();
int b=0,w=0,bl=0,wh=0;
iFOR( i,1,siz){
if(str[i-1]!=str[i]) {
if(str[i]=='B') b++;else w++;
a++;
}
if(str[siz-i]!=str[siz-i+1]){
if(str[i]=='B') bl++;else wh++;
b++;
}
}
cout <<a fin;
return 0;
}
Submission Info
Submission Time |
|
Task |
C - 1D Reversi |
User |
ei1821 |
Language |
C++14 (GCC 5.4.1) |
Score |
300 |
Code Size |
1110 Byte |
Status |
AC |
Exec Time |
2 ms |
Memory |
512 KB |
Judge Result
Set Name |
sample |
All |
Score / Max Score |
0 / 0 |
300 / 300 |
Status |
|
|
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 |
2 ms |
512 KB |
alternate_02.txt |
AC |
2 ms |
512 KB |
random_01.txt |
AC |
2 ms |
512 KB |
random_02.txt |
AC |
2 ms |
512 KB |
random_03.txt |
AC |
2 ms |
512 KB |
random_04.txt |
AC |
2 ms |
512 KB |
random_05.txt |
AC |
2 ms |
512 KB |
same_01.txt |
AC |
1 ms |
512 KB |
same_02.txt |
AC |
1 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 |