結果

問題 No.197 手品
ユーザー dnish
提出日時 2017-05-03 11:09:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 642 bytes
コンパイル時間 1,502 ms
コンパイル使用メモリ 168,616 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 13:45:31
合計ジャッジ時間 2,697 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
using namespace std;

int main(){
	string sb,sa,ans="FAILURE";
	int N;
	cin>>sb>>N>>sa;
	string rsb=sb;
	reverse(rsb.begin(),rsb.end());
	int cntb=count(sb.begin(),sb.end(),'o');
	int cnta=count(sa.begin(),sa.end(),'o');

	if(N==0) {
		if(sa!=sb) ans="SUCCESS";
	}
	else if(cnta!=cntb) ans="SUCCESS";
	else if(cnta==0||cnta==3){

	}
	else if(sa=="oxo"||sa=="xox"){
		if((sa==sb && N%2)||(sa!=sb && N%2==0))
			ans="SUCCESS";
	}
	else if(((sa==sb || sa==rsb) && N%2)||(!(sa==sb || sa==rsb) && N%2==0))
			ans="SUCCESS";

	p(ans);
	return 0;
}
0