結果

問題 No.2601 Very Poor
ユーザー GlinTFrauleinGlinTFraulein
提出日時 2024-01-12 22:21:28
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,899 bytes
コンパイル時間 4,379 ms
コンパイル使用メモリ 263,352 KB
実行使用メモリ 11,324 KB
最終ジャッジ日時 2024-01-12 22:21:36
合計ジャッジ時間 7,585 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 79 ms
11,324 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 78 ms
11,324 KB
testcase_19 AC 78 ms
11,324 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 77 ms
11,324 KB
testcase_24 AC 78 ms
11,324 KB
testcase_25 AC 78 ms
11,324 KB
testcase_26 AC 77 ms
11,324 KB
testcase_27 AC 78 ms
11,324 KB
testcase_28 AC 79 ms
11,324 KB
testcase_29 AC 78 ms
11,324 KB
testcase_30 AC 78 ms
11,324 KB
testcase_31 AC 78 ms
11,324 KB
testcase_32 AC 78 ms
11,324 KB
testcase_33 AC 78 ms
11,324 KB
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rep3(i, n, k) for (ll i = k; i < n; i++)
#define all(a) a.begin(), a.end()
#define YNeos(bool) (bool ? "Yes" : "No")
#define vllin(a, n) vll a(n); rep(i, n) cin >> a[i]
#define vchin(a, n) vec<char> a(n); rep(i, n) cin >> a[i]


using namespace std;
const ll INF = 1LL << 60;
const ll mod = 998244353;
//const ll mod = 1000000007;
const double pi = acos(-1);

//#ifdef ATCODER
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
//#endif

//Prototype declaration
template <class T, class... U> void gin(T&&, U&&...);
template <typename T> vector<T> read(ll);
template <typename T> void printvec(const T&);
template <class T, class... U> void printany(T&&, U&&...);

//Main Program
int main() {
  ll n, x; gin(n, x);
  vllin(a, n);
  vll a2(n*2);
  rep(i, n) {
    a2[i] = a[i];
    a2[i+n] = a[i];
  }
  

  ll n2 = n*2+1;
  vll ruia2(n2);
  ruia2[0] = 0;
  rep(i, n*2) ruia2[i+1] = ruia2[i] + a2[i];
  
  ll ans = 0;
  rep (i, n) {
    auto itr = lower_bound(all(ruia2), x + ruia2[i]);
    itr--;
    ans = max(ans, *itr - ruia2[i]);
  }

  cout << ans << endl;
}


//Function Definition
void gin() {return;}
template <class T, class... U> void gin(T&& now,  U&&... next) {
  cin >> now;
  gin(forward<U> (next)...);
}

template <typename T> vector<T> read(ll n) {
  vector<T> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  return v;
}

template <typename T> void printvec(const T& a) {
  for (int i = 0; i < a.size(); i++) {
    cout << a[i];
    if (i == a.size() - 1) cout << endl;
    else cout << ' ';
  }
}

void printany() {cout << endl;}
template <class T, class... U> void printany(T&& now, U&&... next) {
  cout << now << ' ';
  printany(forward<U> (next)...);
}
0