結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,376 KB
testcase_20 WA -
testcase_21 AC 1 ms
4,380 KB
testcase_22 WA -
testcase_23 AC 2 ms
4,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 2 ms
4,376 KB
testcase_28 AC 2 ms
4,376 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 ) );

  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 %= K + 1;
      itr++;

    } else {

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

  }


  for( uint d = 0 ; d < 20 ; d++ ){

    itr = A.begin();

    bool b = true;
    
    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;

    }
    
  }

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