結果

問題 No.197 手品
ユーザー aaaaaaiu
提出日時 2019-08-08 15:04:22
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 950 bytes
コンパイル時間 2,218 ms
コンパイル使用メモリ 192,792 KB
最終ジャッジ日時 2025-01-07 11:01:21
ジャッジサーバーID
(参考情報)
judge5 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    string s,t;
    int n;
    cin>>s>>n>>t;
    if (n==0) {
        if (s!=t) puts("SUCCESS");
        else puts("FAILURE");
        return 0;
    }
    int sc,tc;
    sc=tc=0;
    for (char c:s) sc+=c=='o';
    for (char c:t) tc+=c=='o';
    if (sc!=tc) {
        puts("SUCCESS");
        return 0;
    }
    if (sc==0||sc==3) {
        puts("FAILURE");
        return 0;
    }
    if (n==1) {
        if (sc==1) {
            if (s[0]=='o'&&t[2]=='o'||s[2]=='o'&&t[0]=='o'||s[1]=='o'&&t[1]=='o') {
                puts("SUCCESS");
            } else {
                puts("FAILURE");
            }
        } else {
            if (s=="oox"&&t=="xoo"||s=="xoo"&&t=="oox"||s=="oxo"&&t=="oxo") {
                puts("SUCCESS");
            } else {
                puts("FAILURE");
            }
        }
        return 0;
    }
    puts("FAILURE");
    return 0;
}
0