結果
問題 | No.669 対決!!! 飲み比べ |
ユーザー |
👑 |
提出日時 | 2018-04-06 22:34:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 921 bytes |
コンパイル時間 | 605 ms |
コンパイル使用メモリ | 68,140 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-26 10:51:15 |
合計ジャッジ時間 | 1,586 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 2 |
other | AC * 18 WA * 7 |
ソースコード
#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 %= K;itr++;} else {*itr = *itr * 10 + ( s1[i] - '0' );}}while( K > 0 ){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;}K /= 2;}cout << "NO" << endl;return 0;}