結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-04-29 20:57:25 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 648 bytes |
コンパイル時間 | 1,592 ms |
コンパイル使用メモリ | 160,648 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-27 08:57:59 |
合計ジャッジ時間 | 2,469 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 15 WA * 28 |
ソースコード
#include<bits/stdc++.h>using namespace std;int rev(string str){int ret=0;replace(str.begin(),str.end(),'x','0');replace(str.begin(),str.end(),'o','1');for(int i=0;i<str.size();i++){for(int j=i+1;j<str.size();j++){if(str[i]>str[j])ret++;}}return ret;}int main(){string s,t;int n;cin>>s>>n>>t;if(count(s.begin(),s.end(),'o')!=count(t.begin(),t.end(),'o')){cout<<"SUCCESS"<<endl;return 0;}int latte=abs(rev(s)-rev(t));if(latte%2==n%2&&latte<=n){cout<<"FAILURE"<<endl;}else cout<<"SUCCEES"<<endl;return 0;}