結果

問題 No.669 対決!!! 飲み比べ
ユーザー 👑 p-adicp-adic
提出日時 2018-04-06 22:52:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 565 ms
コンパイル使用メモリ 67,772 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 18:05:07
合計ジャッジ時間 1,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 2 ms
4,380 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 2 ms
4,380 KB
testcase_27 WA -
testcase_28 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <list>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;
using uint = unsigned int;
using int64 = int64_t;
using uint64 = uint64_t;

int main()
{

  uint N;
  uint K;
  char s0[7999];

  cin >> N >> K;
  cin.ignore(); 
  cin.getline( s0, sizeof( s0 ) );

  K++;
  const string s1 = s0;
  const uint L = s1.size();
  list<uint> A;
  auto itr = A.begin();

  for( uint i = 0 ; i < L ; i++ ){

    if( s1[i] == ' ' ){

      itr++;

    } else {

      *itr = *itr * 10 + ( s1[i] - '0' );
      
    }


  }

  itr = A.begin();

  for( uint j = 0 ; j < N ; j++ ){

    *itr %= K;
    itr++;

  }

  while( K > 0 ){

    itr = A.begin();

    bool b = false;
    
    for( uint j = 0 ; j < N ; j++ ){

      b = ( ( *itr % 2 == 0 ) && b ) || ( ( *itr % 2 == 1 ) && ! b );
      *itr /= 2;
      itr++;

    }

    if( b ){

      cout << "YES" << endl;
      return 0;

    }

    K /= 2;
    
  }

  cout << "NO" << endl;
  return 0;
  
}
0