結果

問題 No.197 手品
ユーザー machy
提出日時 2015-06-13 12:04:22
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,513 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 67,932 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 09:49:03
合計ジャッジ時間 1,641 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;

typedef long long LL;

int main(){
    string before, after;
    int N;
    cin >> before >> N >> after;
    int cnt_b = 0, cnt_a = 0;
    for(int i = 0; i < 3; i++) cnt_b += before[i]=='o'? 1: 0;
    for(int i = 0; i < 3; i++) cnt_a += after[i]=='o'? 1: 0;
    if(cnt_a != cnt_b){
        cout << "SUCCESS" << endl;
        return 0;
    }
    if(cnt_a == 1){
        int pos_b = 0;
        int pos_a = 0;
        for(int i = 0; i < 3; i++){
            if(before[i]=='o'){
                pos_b = i;
                break;
            }
        }
        for(int i = 0; i < 3; i++){
            if(after[i]=='o'){
                pos_a = i;
                break;
            }
        }
        if(max(pos_a-pos_b, pos_b-pos_a) > N){
            cout << "SUCCESS" << endl;
        }else{
            cout << "FAILURE" << endl;
        }
    }else if(cnt_a == 2){
        int pos_b = 0;
        int pos_a = 0;
        for(int i = 0; i < 3; i++){
            if(before[i]=='x'){
                pos_b = i;
                break;
            }
        }
        for(int i = 0; i < 3; i++){
            if(after[i]=='x'){
                pos_a = i;
                break;
            }
        }
        if(max(pos_a-pos_b, pos_b-pos_a) > N){
            cout << "SUCCESS" << endl;
        }else{
            cout << "FAILURE" << endl;
        }
    }else{
        cout << "FAILURE" << endl;
    }
    return 0;
}
0