結果

問題 No.944 煎っぞ!
ユーザー ateate
提出日時 2020-01-19 00:11:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 342 ms / 3,000 ms
コード長 1,736 bytes
コンパイル時間 2,267 ms
コンパイル使用メモリ 201,228 KB
実行使用メモリ 4,848 KB
最終ジャッジ日時 2023-09-10 22:36:07
合計ジャッジ時間 13,276 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 248 ms
4,660 KB
testcase_01 AC 269 ms
4,620 KB
testcase_02 AC 263 ms
4,612 KB
testcase_03 AC 269 ms
4,552 KB
testcase_04 AC 246 ms
4,620 KB
testcase_05 AC 301 ms
4,548 KB
testcase_06 AC 247 ms
4,612 KB
testcase_07 AC 246 ms
4,740 KB
testcase_08 AC 273 ms
4,544 KB
testcase_09 AC 297 ms
4,544 KB
testcase_10 AC 127 ms
4,380 KB
testcase_11 AC 192 ms
4,380 KB
testcase_12 AC 175 ms
4,380 KB
testcase_13 AC 77 ms
4,380 KB
testcase_14 AC 192 ms
4,380 KB
testcase_15 AC 175 ms
4,380 KB
testcase_16 AC 77 ms
4,384 KB
testcase_17 AC 84 ms
4,380 KB
testcase_18 AC 192 ms
4,380 KB
testcase_19 AC 192 ms
4,376 KB
testcase_20 AC 235 ms
4,552 KB
testcase_21 AC 233 ms
4,744 KB
testcase_22 AC 341 ms
4,848 KB
testcase_23 AC 282 ms
4,552 KB
testcase_24 AC 272 ms
4,556 KB
testcase_25 AC 247 ms
4,640 KB
testcase_26 AC 248 ms
4,556 KB
testcase_27 AC 233 ms
4,376 KB
testcase_28 AC 54 ms
4,376 KB
testcase_29 AC 62 ms
4,380 KB
testcase_30 AC 259 ms
4,672 KB
testcase_31 AC 342 ms
4,552 KB
testcase_32 AC 326 ms
4,680 KB
testcase_33 AC 260 ms
4,740 KB
testcase_34 AC 260 ms
4,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int main(){

  int n;
  cin>>n;
  vector<ll> a(n);
  cin>>a;

  vector<ll> s(n+1);
  rep(i,n)s[i+1]=s[i]+a[i];

  ll ans = 0;
  for(ll sum=*max_element(a.begin(),a.end());sum<=1e7;++sum){
    ll cnt=0,now=0;
    while(now<n){
      ll key = s[now]+sum;
      auto itr = lower_bound(s.begin(),s.end(),key);
      if(*itr!=key){cnt=0;break;};
      cnt++;
      now = itr-s.begin();
    }
    chmax(ans,cnt);
  }
  cout<<(ans)<<endl;


}
0