CODE FESTIVAL 2016 Relay (Parallel)

Submission #1355360

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

string solve(string s)
{
    int S = s.size();
    string NG = "No", OK = "Yes";
    rep(i,S)
    {
        if(s[i]=='b' && s[S-1-i]!='d') return NG;
        if(s[i]=='d' && s[S-1-i]!='b') return NG;
        if(s[i]=='p' && s[S-1-i]!='q') return NG;
        if(s[i]=='q' && s[S-1-i]!='p') return NG;
    }
    return OK;
}

int main()
{
    string s;
    cin >>s;
    cout << solve(s) << endl;
    return 0;
}

Submission

Task問題 B - 鏡文 / Mirror String
User nameユーザ名 imulan
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 933 Byte
File nameファイル名
Exec time実行時間 5 ms
Memory usageメモリ使用量 512 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt
All 100 / 100 sample_01.txt,sample_02.txt,sample_01.txt,sample_02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask1_01.txt AC 3 ms 384 KB
subtask1_02.txt AC 5 ms 512 KB
subtask1_03.txt AC 4 ms 384 KB
subtask1_04.txt AC 1 ms 256 KB
subtask1_05.txt AC 4 ms 512 KB
subtask1_06.txt AC 2 ms 256 KB
subtask1_07.txt AC 3 ms 384 KB
subtask1_08.txt AC 2 ms 256 KB
subtask1_09.txt AC 4 ms 384 KB
subtask1_10.txt AC 5 ms 512 KB
subtask1_11.txt AC 5 ms 512 KB
subtask1_12.txt AC 5 ms 512 KB
subtask1_13.txt AC 5 ms 512 KB
subtask1_14.txt AC 5 ms 512 KB
subtask1_15.txt AC 5 ms 512 KB
subtask1_16.txt AC 5 ms 512 KB
subtask1_17.txt AC 5 ms 512 KB
subtask1_18.txt AC 5 ms 512 KB
subtask1_19.txt AC 5 ms 512 KB