結果
問題 | No.1211 円環はお断り |
ユーザー | snow39 |
提出日時 | 2020-08-30 15:15:52 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,416 bytes |
コンパイル時間 | 815 ms |
コンパイル使用メモリ | 102,128 KB |
実行使用メモリ | 31,620 KB |
最終ジャッジ日時 | 2024-04-27 08:08:16 |
合計ジャッジ時間 | 11,179 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 1 ms
6,940 KB |
testcase_02 | AC | 1 ms
6,940 KB |
testcase_03 | AC | 1 ms
6,944 KB |
testcase_04 | AC | 2 ms
6,940 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 1 ms
6,944 KB |
testcase_07 | AC | 3 ms
6,940 KB |
testcase_08 | AC | 1 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,944 KB |
testcase_10 | AC | 2 ms
6,944 KB |
testcase_11 | AC | 2 ms
6,940 KB |
testcase_12 | AC | 1 ms
6,940 KB |
testcase_13 | AC | 1,090 ms
18,192 KB |
testcase_14 | AC | 1,567 ms
23,744 KB |
testcase_15 | AC | 1,648 ms
23,152 KB |
testcase_16 | TLE | - |
testcase_17 | AC | 185 ms
6,940 KB |
testcase_18 | AC | 1,277 ms
20,156 KB |
testcase_19 | AC | 195 ms
6,944 KB |
testcase_20 | AC | 255 ms
6,944 KB |
testcase_21 | AC | 247 ms
6,944 KB |
testcase_22 | AC | 1,169 ms
18,640 KB |
testcase_23 | AC | 1,347 ms
21,052 KB |
testcase_24 | AC | 822 ms
13,812 KB |
testcase_25 | AC | 33 ms
6,944 KB |
testcase_26 | AC | 1,736 ms
25,732 KB |
testcase_27 | AC | 840 ms
13,852 KB |
testcase_28 | AC | 1,771 ms
25,028 KB |
testcase_29 | AC | 1,262 ms
20,000 KB |
testcase_30 | AC | 1,868 ms
27,036 KB |
testcase_31 | AC | 674 ms
12,240 KB |
testcase_32 | TLE | - |
testcase_33 | TLE | - |
testcase_34 | TLE | - |
testcase_35 | TLE | - |
testcase_36 | TLE | - |
testcase_37 | TLE | - |
testcase_38 | TLE | - |
testcase_39 | TLE | - |
testcase_40 | TLE | - |
testcase_41 | AC | 1 ms
6,944 KB |
testcase_42 | AC | 2 ms
6,940 KB |
ソースコード
#include <iostream> #include <algorithm> #include <string> #include <vector> #include <cmath> #include <map> #include <queue> #include <iomanip> #include <set> #include <tuple> #define mkp make_pair #define mkt make_tuple #define rep(i,n) for(int i = 0; i < (n); ++i) #define all(v) v.begin(),v.end() using namespace std; typedef long long ll; const ll MOD=1e9+7; template<class T> void chmin(T &a,const T &b){if(a>b) a=b;} template<class T> void chmax(T &a,const T &b){if(a<b) a=b;} int N,K; vector<ll> A; const ll INF=1e16; bool judge(ll lim){ int M=A.size(); vector<vector<int>> to(M,vector<int> (20,M)); vector<ll> sum={0}; rep(i,M){ ll val=A[i]+sum[i]; sum.push_back(val); } for(int i=0;i<M;i++){ int z=lower_bound(all(sum),sum[i]+lim)-sum.begin(); to[i][0]=z; } for(int k=1;k<20;k++) for(int i=0;i<M;i++){ if(to[i][k-1]==M) to[i][k]=M; else to[i][k]=to[to[i][k-1]][k-1]; } for(int i=0;i<N;i++){ int now=i; for(int k=0;k<20;k++){ if(K&(1<<k)) now=to[now][k]; if(now==M) break; } if(now-i<=N) return true; } return false; } int main(){ cin.tie(0); ios::sync_with_stdio(false); cin>>N>>K; A.resize(N); rep(i,N) cin>>A[i]; rep(i,N) A.push_back(A[i]); A.push_back(INF); ll ok=1,ng=INF; while(abs(ok-ng)>1){ ll mid=(ok+ng)/2; if(judge(mid)) ok=mid; else ng=mid; } cout<<ok<<endl; return 0; }