結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2016-11-26 16:59:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 800 bytes |
コンパイル時間 | 1,519 ms |
コンパイル使用メモリ | 168,712 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-27 13:36:44 |
合計ジャッジ時間 | 2,683 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 39 WA * 4 |
ソースコード
#include <bits/stdc++.h> using namespace std; const string msg[] = { "FAILURE", "SUCCESS" }; signed main(){ string s1; cin >> s1; int N; cin >> N; string s2; cin >> s2; int ocnt = 0; for( int i = 0; i < s1.size(); ++i ) ocnt += s1[ i ] == 'o'; for( int i = 0; i < s2.size(); ++i ) ocnt -= s2[ i ] == 'o'; if( ocnt != 0 ) cout << msg[ 1 ] << endl, exit( 0 ); if( N == 0 ) cout << msg[ s1 != s2 ] << endl, exit( 0 ); if( N >= 2 ) cout << msg[ 0 ] << endl, exit( 0 ); if( N == 1 ){ for( int i = 0; i < s1.size(); ++i ) for( int j = i + 1; j < s1.size(); ++j ){ string t = s1; swap( t[ i ], t[ j ] ); if( t == s2 ) cout << msg[ 0 ] << endl, exit( 0 ); } cout << msg[ 1 ] << endl, exit( 0 ); } return 0; }