481
-627 632 -342 911 -452 -104 -32 -718 92 -725 -565 311 415 -273 459 773 545 -319 -191 685 -394 3
<2020 bytes omitted>
用户输出
12898
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#68901 | #1289. 最大连续子序列 | Accepted | 100 | 99 ms | 4584 K | C++ 11 / 699 B | 该起什么名字 | 2022-04-20 17:32:45 |
#include <bits/stdc++.h>
#define F(i, n, m) for (int i = n; i < m; i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
inline int read() {
int num = 0;
char c;
bool flag = false;
while ((c = getchar()) == ' ' || c == '\n' || c == '\r')
;
if (c == '-')
flag = true;
else
num = c - '0';
while (isdigit(c = getchar())) num = num * 10 + c - '0';
return (flag ? -1 : 1) * num;
}
int a[1000005], dp[1000005];
int main() {
std::ios::sync_with_stdio(false);
int n;
n = read();
int ans = 0;
F(i, 0, n) a[i] = read();
F(i, 0, n) {
dp[i] = max(dp[i - 1] + a[i], a[i]);
ans = max(ans, dp[i]);
}
cout << ans;
return 0;
}
481
-627 632 -342 911 -452 -104 -32 -718 92 -725 -565 311 415 -273 459 773 545 -319 -191 685 -394 3
<2020 bytes omitted>
用户输出
12898
系统信息
Exited with return code 0
566
-551 -518 -267 -536 -324 -657 -939 -190 394 -939 -352 124 -164 458 -609 -355 369 277 253 -380 7
<2431 bytes omitted>
用户输出
10030
系统信息
Exited with return code 0
用户输出
1231
系统信息
Exited with return code 0
85
-125 -33 179 878 -541 376 356 207 436 -166 -240 366 -155 -782 45 -270 378 325 870 725 235 308 24
<277 bytes omitted>
用户输出
4342
系统信息
Exited with return code 0
821
-791 261 233 -105 79 -276 -150 -953 59 -468 -433 562 -373 -957 -127 979 -261 902 158 -700 780 2
<3489 bytes omitted>
用户输出
37945
系统信息
Exited with return code 0
725
-345 -280 -673 282 -32 333 546 -221 -817 -110 -886 -454 -517 -568 498 285 154 -181 523 43 -116
<3131 bytes omitted>
用户输出
10448
系统信息
Exited with return code 0
958
307 68 -974 -978 -268 564 -556 -685 -638 824 393 812 370 -601 879 604 141 -31 440 740 -238 -927
<4128 bytes omitted>
用户输出
27527
系统信息
Exited with return code 0
875
-511 421 232 932 477 662 402 120 525 642 -399 344 -110 -96 -443 289 -79 -727 -155 -562 -646 -20
<3738 bytes omitted>
用户输出
33599
系统信息
Exited with return code 0
294
73 774 7 242 -762 -662 -110 459 -638 -640 -408 -337 -508 -14 -502 -350 885 199 -780 -758 875 -5
<1207 bytes omitted>
用户输出
7374
系统信息
Exited with return code 0
512
-462 196 814 482 987 -985 -781 -235 94 -956 335 -952 -92 610 493 -378 25 573 -304 -619 500 -804
<2132 bytes omitted>
用户输出
20497
系统信息
Exited with return code 0
469754
663 -949 634 623 377 -411 -842 -401 -321 922 -206 250 -175 -875 -910 -163 670 898 -840 373 1
<2063090 bytes omitted>
用户输出
274973
系统信息
Exited with return code 0
161178
-28 466 361 81 -157 -456 984 555 -796 448 895 -604 -67 963 -516 -937 589 710 -968 -816 -511
<707954 bytes omitted>
用户输出
161885
系统信息
Exited with return code 0
193774
544 -776 -847 307 -539 -989 -767 755 -653 356 -361 -746 -823 891 451 992 -797 -133 -913 365
<850691 bytes omitted>
用户输出
214682
系统信息
Exited with return code 0
373300
-553 -756 -636 649 -135 -407 -579 -325 42 -30 16 168 570 -161 615 -289 -314 266 -268 -631 12
<1639542 bytes omitted>
用户输出
236604
系统信息
Exited with return code 0