結果

問題 No.197 手品
ユーザー dnish
提出日時 2018-06-15 10:46:47
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 723 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 168,216 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:54:36
合計ジャッジ時間 2,533 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) (a)<=(n)&&(n)<(b)
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
typedef long long ll;
using namespace std;
const ll inf =1e18;

string s1,s2;
int n;
int main(){
    while(cin>>s1>>n>>s2){
        string ans="FAILURE";
        int cnt = count(ALL(s1),'o');
        if(cnt!=count(ALL(s2),'o')){
            ans="SUCCESS";
        }else{
            if(n==0&&s1!=s2) {
                ans="SUCCESS";
            }
            reverse(ALL(s2));
            if(n==1&&(cnt==1||cnt==2)&&s1==s2){
                ans="SUCCESS";
            }
        }
        p(ans);
    }

}
0