QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#50412#4837. RamenYaoBIG#AC ✓12ms3796kbC++17482b2022-09-25 22:59:252022-09-25 22:59:26

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-09-25 22:59:26]
  • 评测
  • 测评结果:AC
  • 用时:12ms
  • 内存:3796kb
  • [2022-09-25 22:59:25]
  • 提交

answer

#include "bits/stdc++.h"
#define rep(i, a, n) for (int i = a; i <= n; ++i)
#define revrep(i, a, n) for (int i = n; i >= a; --i)
using namespace std;
using vi = vector<int>;
using ll = long long;
using pii = pair<int, int>;

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	
	int n; cin >> n;
	vi as(n);
	for (auto &x: as) cin >> x;
	int ok = 1;
	rep(i, 1, n - 1) {
		if (as[i - 1] <= 0) ok = 0;
		as[i] += as[i - 1];
	}
	puts(ok ? "YES" : "NO");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3500kb

input:

3
1 2 -5

output:

YES

result:

ok answer is YES

Test #2:

score: 0
Accepted
time: 2ms
memory: 3676kb

input:

5
2 -5 2 3 1

output:

NO

result:

ok answer is NO

Test #3:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

5
3 -2 1 -1 -1

output:

YES

result:

ok answer is YES

Test #4:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

5
-1 100 100 100 100

output:

NO

result:

ok answer is NO

Test #5:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

5
3 -3 2 5 1

output:

NO

result:

ok answer is NO

Test #6:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

10
1 2 3 4 5 -15 100 200 300 100

output:

NO

result:

ok answer is NO

Test #7:

score: 0
Accepted
time: 2ms
memory: 3624kb

input:

10
1 2 3 4 5 -14 100 200 300 100

output:

YES

result:

ok answer is YES

Test #8:

score: 0
Accepted
time: 5ms
memory: 3792kb

input:

99994
10158 8007 -9962 16609 -8963 14302 19425 11985 13981 -979 -745 19900 -13546 10379 -9187 19083 -6575 -10263 6492 12375 -19156 2959 8395 2133 -745 10010 -7647 17523 -920 19590 -5036 -7383 -16011 13687 18845 -4718 -16154 11768 -9905 9707 10354 18859 -7034 2037 -4213 13330 3395 -90 19861 -10341 14...

output:

NO

result:

ok answer is NO

Test #9:

score: 0
Accepted
time: 2ms
memory: 3692kb

input:

99999
17194 659 -10222 -6364 14182 4302 3244 15726 11840 17789 -2087 -4609 -8774 -1505 76 13646 8907 1417 16085 7682 -17047 17981 6878 -16761 -17676 768 10165 9307 15123 12684 1784 17980 1307 3335 -18089 -16845 -5992 -5242 2073 9794 4947 19483 -19560 1248 367 6930 7336 -7357 -18738 7525 -5302 -1798 ...

output:

NO

result:

ok answer is NO

Test #10:

score: 0
Accepted
time: 5ms
memory: 3700kb

input:

99990
4155 11236 7443 -7262 17251 -5697 -13088 -610 -10226 -3443 -5730 -9043 13925 -13540 9339 10207 6462 -6828 7903 -19238 -17088 -6998 -14564 -15579 5395 -8474 -9874 18867 -8834 7928 10753 -18884 -1452 -4868 7204 -8895 -15906 17901 16351 12031 19615 17806 -12009 18233 4797 -1772 -8799 5301 -19335 ...

output:

NO

result:

ok answer is NO

Test #11:

score: 0
Accepted
time: 12ms
memory: 3772kb

input:

99999
11191 -18187 5033 11915 2545 6529 10733 3130 7559 -4600 12852 -13628 18697 -3349 827 4619 1867 4852 17496 13920 -14980 8025 -16081 7678 -11536 2209 7938 10500 7209 1023 17572 -13446 15865 4856 -9805 18980 16482 -19034 -9371 -7807 12058 18430 15466 -2632 9378 11753 -4858 -1966 -17934 -18668 107...

output:

NO

result:

ok answer is NO

Test #12:

score: 0
Accepted
time: 5ms
memory: 3700kb

input:

99990
-1849 14466 -17302 -11058 -14312 16454 14477 -13205 5418 14169 11359 1864 1394 4692 10090 1180 -578 16683 9313 -13000 -12871 821 4629 -11216 -10541 -7033 5825 -19941 -16749 14042 6466 -8158 13107 -5496 -4588 6854 -13357 -15967 -17318 -5570 -13275 19054 2940 14354 -6118 -14724 19008 -9233 -1853...

output:

NO

result:

ok answer is NO

Test #13:

score: 0
Accepted
time: 5ms
memory: 3720kb

input:

100000
3256 -393 -1566 -254 1643 171 17117 -6703 3439 430 -5978 -8107 11052 -5867 -6184 8980 716 -2475 5074 -4621 -1122 195 -3249 9558 -5361 8403 -10705 1153 2092 -9508 -564 4828 -1183 -1582 9700 -11574 11996 4873 -3659 4912 -14807 13752 -6182 2644 -3722 -9454 1939 16538 -5008 -11571 -2375 2856 1501...

output:

YES

result:

ok answer is YES

Test #14:

score: 0
Accepted
time: 7ms
memory: 3612kb

input:

99999
3716 7957 -1428 4345 -9534 10561 -9364 -3664 10439 3785 2087 -15342 11341 -14891 16973 -16165 17969 -11921 10993 -14719 1816 -1 546 7581 4321 -5137 4147 -6070 -1332 9895 -8333 -8576 3005 3569 1332 -6121 12691 -3915 -9274 14443 -9650 -7299 732 6834 -1743 6449 -1499 3430 -11491 15675 -7053 -8256...

output:

YES

result:

ok answer is YES

Test #15:

score: 0
Accepted
time: 11ms
memory: 3692kb

input:

99998
4601 14887 -12462 -1501 9650 -847 -7142 3859 438 2020 1690 -7303 6310 -7997 10081 -6678 -3073 179 1340 11196 -13090 10426 2903 -11134 9121 -11716 12480 -14319 9444 -1185 4900 -16097 11908 -6393 -6289 17026 -8290 1177 -2384 3918 2510 -7684 -1871 -2761 2260 11761 -1374 2963 -15829 15393 -15443 1...

output:

YES

result:

ok answer is YES

Test #16:

score: 0
Accepted
time: 11ms
memory: 3772kb

input:

99997
5487 9111 -390 -851 3425 -9150 3591 8279 -16861 11743 -6002 5056 -3041 -5295 7380 5915 -4116 -11912 4390 8599 -7996 3958 2155 -12954 17025 -2486 -14994 2840 7514 439 -7275 3680 2026 -7971 9195 4365 -1975 -2115 1400 1905 -13840 4633 11334 -867 -13737 177 12542 -1695 -167 -4889 11976 -11089 -773...

output:

YES

result:

ok answer is YES

Test #17:

score: 0
Accepted
time: 5ms
memory: 3504kb

input:

35463
13546 3476 -6797 6615 -14704 -1723 14905 -9446 5489 -1136 -8495 15105 -5854 -9075 9791 -1166 1461 1108 3811 -14634 14811 -11520 5183 4375 -9468 5128 -7021 -2530 14019 -12922 17280 -9581 1671 7924 -17272 14591 -4190 -4374 -310 10380 -10267 -4384 7498 386 7873 -1167 -5530 2379 -9658 -651 8416 52...

output:

YES

result:

ok answer is YES

Test #18:

score: 0
Accepted
time: 2ms
memory: 3560kb

input:

10
6451 4281 -4304 3221 -5221 -607 3277 -4342 -1157 -8248

output:

YES

result:

ok answer is YES

Test #19:

score: 0
Accepted
time: 11ms
memory: 3688kb

input:

100000
19832 -5813 -10172 7718 -5429 -2056 7015 -1812 -6728 10403 -2236 -114 3408 4686 -11161 -4422 911 4985 7318 -3548 -7926 358 12828 -17317 15166 -652 -2014 6322 -10464 9126 -16816 5272 6796 5788 -8976 7423 -12326 2232 11882 -1065 -7293 -7174 1960 13971 -3264 -16541 16210 -894 -14486 13684 -14317...

output:

NO

result:

ok answer is NO

Test #20:

score: 0
Accepted
time: 11ms
memory: 3796kb

input:

99999
292 2537 14158 -8771 290 1038 4725 4332 -8240 9566 -14171 -1941 10993 -4337 -8005 10433 -1836 -4461 13237 -942 -17692 12866 3919 -16189 1743 5807 -7161 3290 9217 -2959 2711 -10020 10984 -2981 2656 -5908 -143 6148 860 -8431 -7127 14879 -8151 6672 6011 -637 -14523 14509 -13673 5122 8300 -14194 3...

output:

NO

result:

ok answer is NO

Test #21:

score: 0
Accepted
time: 7ms
memory: 3560kb

input:

99998
1177 2170 13526 -13529 6769 1247 6947 -11250 10270 -8007 5433 -13903 13259 -10148 14704 -16976 17122 -16553 7776 -7731 7402 -899 3172 1991 -3056 4637 1171 -4959 7288 -14039 8649 -2949 -7409 12466 2330 -11273 -5316 14345 -15356 13749 -375 -12803 17759 -11435 -1474 11971 -17503 5531 -2203 -2456 ...

output:

NO

result:

ok answer is NO

Test #22:

score: 0
Accepted
time: 11ms
memory: 3780kb

input:

99997
14766 3692 -4804 6033 -7966 -7058 14577 -7918 -2836 1716 -2260 9944 -284 1066 -701 -7487 -818 5149 1226 -4920 -207 -72 -4872 -4020 1743 5355 -3200 8009 -6257 3393 -10823 1019 2710 13992 -2186 -15422 17895 -4756 -8466 -968 7465 -4676 10963 -9541 -4767 13091 -16290 8168 6163 366 -8479 10269 -636...

output:

NO

result:

ok answer is NO

Test #23:

score: 0
Accepted
time: 8ms
memory: 3564kb

input:

35463
17418 -16536 3382 -1094 1200 9971 -2495 -2666 -4678 1541 -561 8506 -3097 8773 -18290 1240 1655 1272 648 -3960 6919 -7166 1259 10206 1458 -14327 1670 17230 -5832 1520 -14780 3567 -1838 14079 -3245 -6412 -1216 12985 -4768 -5198 -3553 899 -169 11713 -15862 15938 -11258 10355 -1440 -9988 -4743 193...

output:

NO

result:

ok answer is NO

Test #24:

score: 0
Accepted
time: 2ms
memory: 3616kb

input:

10
10323 4268 -5613 -8978 7879 9869 -15338 16358 -11324 -6107

output:

NO

result:

ok answer is NO

Test #25:

score: 0
Accepted
time: 2ms
memory: 3612kb

input:

1
1

output:

YES

result:

ok answer is YES

Test #26:

score: 0
Accepted
time: 2ms
memory: 3712kb

input:

1
0

output:

YES

result:

ok answer is YES

Test #27:

score: 0
Accepted
time: 2ms
memory: 3708kb

input:

1
-1

output:

YES

result:

ok answer is YES

Test #28:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

1
-20000

output:

YES

result:

ok answer is YES

Test #29:

score: 0
Accepted
time: 1ms
memory: 3536kb

input:

2
1 1

output:

YES

result:

ok answer is YES

Test #30:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

2
0 1

output:

NO

result:

ok answer is NO

Test #31:

score: 0
Accepted
time: 3ms
memory: 3652kb

input:

2
-1 1

output:

NO

result:

ok answer is NO

Test #32:

score: 0
Accepted
time: 2ms
memory: 3644kb

input:

2
1 -1

output:

YES

result:

ok answer is YES

Test #33:

score: 0
Accepted
time: 3ms
memory: 3620kb

input:

2
1 -2

output:

YES

result:

ok answer is YES