結果
| 問題 |
No.1465 Archaea
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-04-02 21:33:37 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 429 bytes |
| コンパイル時間 | 755 ms |
| コンパイル使用メモリ | 74,740 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-24 01:09:26 |
| 合計ジャッジ時間 | 1,686 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
6 | main()
| ^~~~
ソースコード
#include<iostream>
#include<queue>
using namespace std;
int dist[2<<17];
int N,K;
main()
{
cin>>N>>K;
for(int i=0;i<=N;i++)dist[i]=K+1;
dist[N]=0;
queue<int>P;
P.push(N);
while(!P.empty())
{
int u=P.front();P.pop();
if(u%2==0&&dist[u/2]>dist[u]+1)
{
dist[u/2]=dist[u]+1;
P.push(u/2);
}
if(u>=4&&dist[u-3]>dist[u]+1)
{
dist[u-3]=dist[u]+1;
P.push(u-3);
}
}
cout<<(dist[1]>K?"NO":"YES")<<endl;
}