結果

問題 No.197 手品
ユーザー alpha_virginis
提出日時 2015-04-29 00:09:13
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 881 bytes
コンパイル時間 1,472 ms
コンパイル使用メモリ 160,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-27 07:41:58
合計ジャッジ時間 2,779 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 38 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

int sub1(std::string str) {
  int ret = 0;
  if( str[0] == 'o' ) ret |= 0x01;
  if( str[1] == 'o' ) ret |= 0x02;
  if( str[2] == 'o' ) ret |= 0x04;
  return ret;
}

int main() {

  bool p[8];

  std::string str1, str2;
  std::string str_o;
  long N;
  long temp;

  for(int i = 0; i < 8; ++i) p[i] = false;

  std::cin >> str1 >> N >> str_o;

  if( N > 8 ) {
    N = 8;
  }

  str2 = str1;
  p[sub1(str_o)] = true;
  for(long i = 0; i < N; ++i) {
    std::swap(str1[0], str1[1]);
    std::swap(str2[1], str2[2]);
    temp = sub1(str1);
    if( p[temp] ) {
      std::cout << "FAILURE" << std::endl;
      return 0;
    }
    p[temp] = true;
    temp = sub1(str2);
    if( p[temp] ) {
      std::cout << "FAILURE" << std::endl;
      return 0;
    }
    p[temp] = true;
    std::swap(str1, str2);
  }

  std::cout << "SUCCESS" << std::endl;

  return 0;
}
0