結果
問題 |
No.78 クジ付きアイスバー
|
ユーザー |
|
提出日時 | 2019-10-12 06:02:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 420 bytes |
コンパイル時間 | 499 ms |
コンパイル使用メモリ | 66,248 KB |
実行使用メモリ | 8,448 KB |
最終ジャッジ日時 | 2024-11-27 04:04:12 |
合計ジャッジ時間 | 22,989 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 TLE * 2 |
コンパイルメッセージ
main.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 11 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N; long K; string s; int sum[55]; long f(long X) { return sum[N]*(X/N)+sum[X%N]; } main() { cin>>N>>K>>s; for(int i=0;i<N;i++)sum[i+1]=sum[i]+(s[i]=='0'?0:s[i]=='1'?1:2); long L=0,R=K; while(R-L>1) { long M=L+R>>1; long T=M,pre=0; while(T<K) { long now=f(T); if(now==pre)break; T+=now-pre; pre=now; } if(T<K)L=M; else R=M; } cout<<R<<endl; }