結果
問題 |
No.669 対決!!! 飲み比べ
|
ユーザー |
👑 |
提出日時 | 2018-04-06 23:07:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 830 bytes |
コンパイル時間 | 616 ms |
コンパイル使用メモリ | 68,720 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 10:51:41 |
合計ジャッジ時間 | 1,518 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 25 |
ソースコード
#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; cin >> N >> K; cin.ignore(); list<uint> A; for( uint j = 0 ; j < N ; j++ ){ uint a; cin >> a; cin.ignore(); A.push_back( a ); } K++; auto 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; }