CODE FESTIVAL 2017 Final (Parallel)

Submission #1812665

Source codeソースコード

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/



string S;
//---------------------------------------------------------------------------------------------------
#define yes "YES"
#define no "NO"
string solve() {
    map<char, int> cnt;
    fore(c, S) cnt[c]++;

    vector<char> v;
    rep(i, 0, 3) v.push_back(char('a' + i));
    do {
        char c0 = v[0], c1 = v[1], c2 = v[2];

        if (cnt[c0] == cnt[c1] and cnt[c1] == cnt[c2]) return yes;
        if (cnt[c0] == cnt[c1] + 1 and cnt[c1] + 1 == cnt[c2] + 1) return yes;
        if (cnt[c0] == cnt[c1] and cnt[c1] == cnt[c2] + 1) return yes;
    } while (next_permutation(v.begin(), v.end()));

    return no;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> S;
    cout << solve() << endl;
}

Submission

Task問題 B - Palindrome-phobia
User nameユーザ名 はまやんはまやん
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 400
Source lengthソースコード長 1753 Byte
File nameファイル名
Exec time実行時間 2 ms
Memory usageメモリ使用量 512 KB

Test case

Set

Set name Score得点 / Max score Cases
sample - sample-01.txt,sample-02.txt,sample-03.txt
All 400 / 400 sample-01.txt,sample-02.txt,sample-03.txt,01-01.txt,01-02.txt,01-03.txt,01-04.txt,01-05.txt,01-06.txt,01-07.txt,01-08.txt,01-09.txt,01-10.txt,01-11.txt,01-12.txt,01-13.txt,01-14.txt,01-15.txt,01-16.txt,01-17.txt,01-18.txt,01-19.txt,01-20.txt,01-21.txt,01-22.txt,01-23.txt,01-24.txt,01-25.txt,01-26.txt,01-27.txt,01-28.txt,01-29.txt,01-30.txt,01-31.txt,sample-01.txt,sample-02.txt,sample-03.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
01-01.txt AC 1 ms 256 KB
01-02.txt AC 1 ms 256 KB
01-03.txt AC 1 ms 256 KB
01-04.txt AC 1 ms 256 KB
01-05.txt AC 1 ms 256 KB
01-06.txt AC 1 ms 256 KB
01-07.txt AC 1 ms 256 KB
01-08.txt AC 1 ms 256 KB
01-09.txt AC 1 ms 256 KB
01-10.txt AC 1 ms 256 KB
01-11.txt AC 1 ms 256 KB
01-12.txt AC 1 ms 256 KB
01-13.txt AC 2 ms 512 KB
01-14.txt AC 2 ms 512 KB
01-15.txt AC 2 ms 512 KB
01-16.txt AC 1 ms 256 KB
01-17.txt AC 1 ms 256 KB
01-18.txt AC 1 ms 256 KB
01-19.txt AC 1 ms 256 KB
01-20.txt AC 1 ms 256 KB
01-21.txt AC 1 ms 256 KB
01-22.txt AC 1 ms 256 KB
01-23.txt AC 1 ms 256 KB
01-24.txt AC 1 ms 256 KB
01-25.txt AC 1 ms 256 KB
01-26.txt AC 1 ms 256 KB
01-27.txt AC 2 ms 512 KB
01-28.txt AC 2 ms 512 KB
01-29.txt AC 2 ms 512 KB
01-30.txt AC 2 ms 512 KB
01-31.txt AC 2 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