結果

問題 No.197 手品
ユーザー koba-e964
提出日時 2015-05-28 03:25:14
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 1,265 bytes
コンパイル時間 740 ms
コンパイル使用メモリ 88,504 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:40:13
合計ジャッジ時間 1,761 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)

using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef pair<int, int> PI;
const double EPS=1e-9;

int enc(string s) {
  return (s[0] == 'o' ? 4 : 0)
    + (s[1] == 'o' ? 2: 0)
    + (s[2] == 'o' ? 1: 0);
}

int main(void){
  string s, t;
  ll n;
  cin >> s >> n >> t;
  int p1 = count(s.begin(), s.end(), 'o');
  int p2 = count(t.begin(), t.end(), 'o');
  if (p1 != p2) {
    cout << "SUCCESS" << endl;
    return 0;
  }
  if (n >= 2) {
    cout << "FAILURE" << endl;
    return 0;
  }
  if (n == 0) {
    cout << (s == t ? "FAILURE" : "SUCCESS") << endl;
    return 0;
  }
  int se = enc(s), te = enc(t);
  int taboo[] = {18,12,33,45,30,51};
  if (count(taboo, taboo + 6, se * 8 + te)) {
    cout << "SUCCESS" << endl;
  } else {
    cout << "FAILURE" << endl;
  }
}
0