結果
問題 | No.1465 Archaea |
ユーザー |
![]() |
提出日時 | 2023-10-16 11:00:31 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 1,264 ms |
コンパイル使用メモリ | 124,868 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 22:12:56 |
合計ジャッジ時間 | 2,185 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 WA * 3 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cassert> #include<cmath> #include<ctime> #include<iomanip> #include<numeric> #include<stack> #include<queue> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<bitset> #include<random> using namespace std; int N,K; int f(int N) { if(N == 1) return 0; if(N == 2) return 1; if(N == 4) return 1; int res = 0,M = 1,r = N%3%2; if(r == 1) { while(M*4 <= N) M *= 4,res += 2; assert((N-M)%3 == 0); res += (N-M)/3; } else { M *= 2; res++; while(M*4 <= N) M *= 4,res += 2; assert((N-M)%3 == 0); res += (N-M)/3; } return res; } void solve() { cin >> N >> K; if(N%3 == 0) { cout << "NO" << endl; return; } int need = f(N); cout << (need <= K ? "YES":"NO") << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); }