結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             machy
                         | 
                    
| 提出日時 | 2015-06-13 12:09:37 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,728 bytes | 
| コンパイル時間 | 815 ms | 
| コンパイル使用メモリ | 68,540 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-27 09:51:06 | 
| 合計ジャッジ時間 | 1,737 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 41 WA * 2 | 
ソースコード
#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){
        if(before == after && N == 1 && before[1] == 'o'){
            cout << "SUCCESS" << endl;
        }
        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){
        if(before == after && N == 1 && before[1] == 'x'){
            cout << "SUCCESS" << endl;
        }
        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;
}
            
            
            
        
            
machy