結果

問題 No.197 手品
ユーザー Bantako
提出日時 2017-08-07 17:58:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 772 bytes
コンパイル時間 1,654 ms
コンパイル使用メモリ 169,132 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:52:42
合計ジャッジ時間 2,959 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    6 | main(){
      | ^~~~

ソースコード

diff #

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int INF = 1e9;
int MOD = 1000000007;
main(){
    int N,cnt = 0;
    string s,t;
    cin >> s >> N >> t;
    for(char c:s)if(c == 'o')cnt++;
    for(char c:t)if(c == 'o')cnt--;
    if(cnt){
        cout << "SUCCESS" << endl;
        return 0;
    }
    if(N == 0){
        if(s == t)cout << "FAILURE" << endl;
        else cout << "SUCCESS" << endl;
    }else if(N == 1){
        using std::swap;
        for(int i = 0;i < 2;i++){
            swap(s[i],s[(i+1)%3]);
            if(s == t){
                cout << "FAILURE" << endl;
                return 0;
            }
            swap(s[i],s[(i+1)%3]);
        }
        cout << "SUCCESS" << endl;
    }else{
        cout << "FAILURE" << endl;
    }
}
0