Contest Duration: ~ (local time) (120 minutes)

Submission #1700488

Source Code Expand

Copy
```#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<cstdio>
#include<cmath>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<int,P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i,x) for(int i=0;i<x;i++)
#define rep1(i,x) for(int i=1;i<=x;i++)
#define rrep(i,x) for(int i=x-1;i>=0;i--)
#define rrep1(i,x) for(int i=x;i>0;i--)
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
#define mp1(a,b,c) P1(a,P(b,c))

const int INF=1000000000;
const int dir_4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const int dir_8[8][2]={{1,0},{1,1},{0,1},{-1,1},{-1,0},{-1,-1},{0,-1},{1,-1}};

int main(){
string s;
cin >> s;
string t = "";
vector<int> v;
int now = 0;
rep(i,s.size()){
if(s[i] == 'x')now ++;
else {
v.pb(now);
now = 0;
t += s[i];
}
}
v.pb(now);

rep(i,t.size()){
if(t[i] != t[t.size()-1-i]){
puts("-1");
return 0;
}
}

int ret = 0;
rep(i,v.size()){
ret += max(v[i],v[v.size()-1-i])-min(v[i],v[v.size()-1-i]);
}
cout << ret/2 << endl;
}

```

#### Submission Info

Submission Time 2017-10-22 21:09:01+0900 C - Inserting 'x' yokozuna57 C++14 (GCC 5.4.1) 400 1440 Byte AC 5 ms 1148 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt
All 400 / 400 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt, 1_13.txt, 1_14.txt, 1_15.txt, 1_16.txt, 1_17.txt, 1_18.txt, 1_19.txt, 1_20.txt, 1_21.txt, 1_22.txt, 1_23.txt, 1_24.txt, 1_25.txt, 1_26.txt, 1_27.txt, 1_28.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
0_03.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 1 ms 256 KB
1_03.txt 2 ms 384 KB
1_04.txt 1 ms 256 KB
1_05.txt 1 ms 256 KB
1_06.txt 5 ms 1148 KB
1_07.txt 4 ms 512 KB
1_08.txt 5 ms 1148 KB
1_09.txt 4 ms 512 KB
1_10.txt 4 ms 512 KB
1_11.txt 4 ms 512 KB
1_12.txt 5 ms 1148 KB
1_13.txt 4 ms 512 KB
1_14.txt 4 ms 512 KB
1_15.txt 4 ms 512 KB
1_16.txt 4 ms 512 KB
1_17.txt 4 ms 512 KB
1_18.txt 4 ms 512 KB
1_19.txt 4 ms 512 KB
1_20.txt 4 ms 512 KB
1_21.txt 5 ms 640 KB
1_22.txt 5 ms 640 KB
1_23.txt 5 ms 768 KB
1_24.txt 5 ms 768 KB
1_25.txt 5 ms 768 KB
1_26.txt 5 ms 768 KB
1_27.txt 5 ms 1148 KB
1_28.txt 5 ms 1148 KB