結果
| 問題 |
No.2601 Very Poor
|
| コンテスト | |
| ユーザー |
Today03
|
| 提出日時 | 2024-01-13 18:09:51 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 521 bytes |
| コンパイル時間 | 1,933 ms |
| コンパイル使用メモリ | 195,300 KB |
| 最終ジャッジ日時 | 2025-02-18 19:46:08 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 16 WA * 18 |
ソースコード
#include <bits/stdc++.h>
#ifdef LOCAL
#include "./debug.cpp"
#else
#define debug(...)
#define print_line
#endif
using namespace std;
using ll = long long;
int main() {
int N;
ll X;
cin >> N >> X;
vector<ll> A(2 * N);
for (int i = 0; i < N; i++) {
cin >> A[i];
A[i + N] = A[i];
}
ll ans = 0, now = 0;
int l = 0, r = 0;
while (l < N) {
while (r < l + N && now + A[r] < X) {
now += A[r];
ans = max(ans, now);
r++;
}
if (r == l)
r++;
else
now -= A[l];
l++;
}
cout << ans << endl;
}
Today03