Submission #1016942


Source Code Expand

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;

int main() {
  string s;
  cin >> s;
  int len = s.length();
  int ans;
  switch (len) {
  case 1: 
    printf("0\n");
    return 0;
  case 2:
    if (s[0] == s[1]) {
      printf("50\n");
    } else {
      printf("48\n");
    }
    return 0;
  case 3:
    if (s[0] == s[2]) {
      printf("50\n");
    } else {
      ans = 25 + 48;
      printf("%d\n", ans);
    }
    return 0;
  }
  deque<bool> same(len/2);
  string sr = s;
  reverse(all(sr));
  int same_n = 0;
  rep (i, len/2) {
    if (s[i] == sr[i]) {
      same_n += 1;
    }
  }
  if (same_n == len/2) {
    ans = len/2 * 2 * 25;
    printf("%d\n", ans);
    return 0;
  } else if (same_n + 1 == len/2) {
    ans = len/2 * 2 * 25;
    ans -= 2;
    if (len % 2 == 1) {
      ans += 25;
    }
    printf("%d\n", ans);
    return 0;
  } else {
    ans = 25 * len;
    printf("%d\n", ans);
    return 0;
  }
  return 0;
}

Submission Info

Submission Time
Task B - こだわりの名前
User tspcx
Language C++11 (GCC 4.8.1)
Score 100
Code Size 1898 Byte
Status AC
Exec Time 30 ms
Memory 1572 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 36
Set Name Test Cases
All hand_1.txt, hand_2.txt, hand_3.txt, hand_4.txt, hand_5.txt, hand_6.txt, palindrome_1.txt, palindrome_12345.txt, palindrome_2.txt, palindrome_299998.txt, palindrome_299999.txt, palindrome_3.txt, palindrome_300000.txt, palindrome_4.txt, palindrome_5.txt, palindrome_6789.txt, palindrome_67890.txt, palindrome_mod_1.txt, palindrome_mod_1000.txt, palindrome_mod_10000.txt, palindrome_mod_100001.txt, palindrome_mod_2.txt, palindrome_mod_200000.txt, palindrome_mod_299999.txt, palindrome_mod_3.txt, palindrome_mod_300000.txt, palindrome_mod_4.txt, palindrome_mod_5.txt, palindrome_mod_50001.txt, random_1.txt, random_10.txt, random_100001.txt, random_101.txt, random_3000.txt, random_300000.txt, random_50001.txt
Case Name Status Exec Time Memory
hand_1.txt AC 30 ms 1444 KB
hand_2.txt AC 28 ms 1444 KB
hand_3.txt AC 29 ms 1440 KB
hand_4.txt AC 29 ms 1532 KB
hand_5.txt AC 28 ms 1444 KB
hand_6.txt AC 30 ms 1452 KB
palindrome_1.txt AC 19 ms 796 KB
palindrome_12345.txt AC 19 ms 928 KB
palindrome_2.txt AC 19 ms 796 KB
palindrome_299998.txt AC 30 ms 1568 KB
palindrome_299999.txt AC 30 ms 1564 KB
palindrome_3.txt AC 17 ms 844 KB
palindrome_300000.txt AC 30 ms 1572 KB
palindrome_4.txt AC 18 ms 924 KB
palindrome_5.txt AC 18 ms 800 KB
palindrome_6789.txt AC 17 ms 796 KB
palindrome_67890.txt AC 21 ms 928 KB
palindrome_mod_1.txt AC 18 ms 796 KB
palindrome_mod_1000.txt AC 16 ms 796 KB
palindrome_mod_10000.txt AC 17 ms 800 KB
palindrome_mod_100001.txt AC 22 ms 1056 KB
palindrome_mod_2.txt AC 19 ms 916 KB
palindrome_mod_200000.txt AC 27 ms 1320 KB
palindrome_mod_299999.txt AC 29 ms 1528 KB
palindrome_mod_3.txt AC 19 ms 800 KB
palindrome_mod_300000.txt AC 30 ms 1568 KB
palindrome_mod_4.txt AC 19 ms 792 KB
palindrome_mod_5.txt AC 18 ms 672 KB
palindrome_mod_50001.txt AC 21 ms 924 KB
random_1.txt AC 17 ms 800 KB
random_10.txt AC 19 ms 796 KB
random_100001.txt AC 21 ms 1052 KB
random_101.txt AC 19 ms 744 KB
random_3000.txt AC 19 ms 796 KB
random_300000.txt AC 30 ms 1528 KB
random_50001.txt AC 20 ms 924 KB
sample_1.txt AC 18 ms 780 KB
sample_2.txt AC 18 ms 672 KB
sample_3.txt AC 18 ms 916 KB