結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2016-11-26 17:00:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 747 bytes |
コンパイル時間 | 1,556 ms |
コンパイル使用メモリ | 168,272 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:50:26 |
合計ジャッジ時間 | 2,789 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#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 ){ string t = s1; swap( t[ i ], t[ i + 1 ] ); if( t == s2 ) cout << msg[ 0 ] << endl, exit( 0 ); } cout << msg[ 1 ] << endl, exit( 0 ); } return 0; }