結果
| 問題 | No.3 ビットすごろく |
| コンテスト | |
| ユーザー |
Deep_Instead
|
| 提出日時 | 2016-01-31 16:16:44 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,057 bytes |
| コンパイル時間 | 875 ms |
| コンパイル使用メモリ | 55,452 KB |
| 実行使用メモリ | 16,960 KB |
| 最終ジャッジ日時 | 2024-09-21 19:40:48 |
| 合計ジャッジ時間 | 12,842 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 32 |
ソースコード
#include <iostream>
using namespace std;
int main()
{
int n, lane, loc, bit, mov;
int through[10050];
bool check[10000];
bool flg, hit;
cin >> n;
flg=true; hit=false;
through[0]=1; check[0]=true;
for( int i=1; i<n; ++i ){ through[i]=0; check[i]=true; }
while( flg )
{
for( int i=0; i<n; ++i )
{
if( 0<through[i] && check[i] )
{
bit=1;
for( int j=i+1; 1<j; j>>=1 )bit+=j&1;
lane=(i-bit)*(0==i);
mov=through[i]+1*(0==i);
check[i]=false;
through[lane]*=(through[lane]<=mov);
while( n-1>lane && 0==through[lane] )
{
through[lane]=mov;
bit=1;
for( int j=lane+1; 1<j; j>>=1 )bit+=j&1;
lane+=bit;
mov++;
through[lane]*=(through[lane]<=mov);
}
if(through[i]+1==mov)flg=false;
else flg=true;
if(n-1==lane)
{
hit=true;
through[n-1]=mov;
}
}
}
if(hit)flg=false;
}
if(!hit)mov=-1;
cout << mov << endl;
return 0;
}
Deep_Instead