QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#360953#7728. Ramencrsfaa#AC ✓3ms5964kbC++141.6kb2024-03-22 16:26:502024-03-22 16:26:50

Judging History

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

  • [2024-03-22 16:26:50]
  • 评测
  • 测评结果:AC
  • 用时:3ms
  • 内存:5964kb
  • [2024-03-22 16:26:50]
  • 提交

answer

#include<bits/stdc++.h>
#define Yukinoshita namespace
#define Yukino std
using Yukinoshita Yukino;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') w=ch=='-'?-1:1,ch=getchar();
	while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
	return s*w;
}
const int mod=998244353;
int qpow(int a,int p)
{
	int mul=1;
	for(;p;p>>=1)
	{
		if(p&1) mul=1ll*mul*a%mod;
		a=1ll*a*a%mod;
	}
	return mul;
}
inline void getmod(int &x)
{
	x-=(x>=mod)*mod;
}
const int mxn=1e6+5;
int fac[mxn],inv[mxn];
void init(int n)
{
	fac[0]=1;
	int i;
	for(i=1;i<=n;i++)
		fac[i]=1ll*fac[i-1]*i%mod;
	inv[n]=qpow(fac[n],mod-2);
	for(i=n;i;i--)
		inv[i-1]=1ll*inv[i]*i%mod;
}
int C(int n,int m)
{
	return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;
}
struct seg
{
	int l,r,tag;
}t[mxn*4];
#define ls w<<1
#define rs ls|1
void build(int w,int l,int r)
{
	t[w].l=l,t[w].r=r;
	if(l<r)
	{
		int mid=l+r>>1;
		build(ls,l,mid);
		build(rs,mid+1,r);
	}
}
void pushup(int w)
{

}
void ad(int w,int v)
{

}
void pushdown(int w)
{
	if(t[w].tag)
		ad(ls,t[w].tag),ad(rs,t[w].tag),t[w].tag=0;
}
int ask(int w,int l,int r)
{
	if(t[w].l>=l&&t[w].r<=r) return 0;
	pushdown(w);
	int s=0;
	if(t[ls].r>=l) s=ask(ls,l,r);
	if(t[rs].l<=r) s+=ask(rs,l,r);
	return s;
}
void add(int w,int l,int r,int v)
{
	if(t[w].l>=l&&t[w].r<=r)
	{
		ad(w,v);
		return;
	}
	pushdown(w);
	if(t[ls].r>=l) add(ls,l,r,v);
	if(t[rs].l<=r) add(rs,l,r,v);
	pushup(w);
}
int a[mxn];
int main()
{
	int n=read(),i;
	for(i=1;i<=n;i++)
		a[i]=read();
	int s=0;
	for(i=1;i<n;i++)
		if((s+=a[i])<=0)
		{
			puts("No");
			return 0;
		}
	cout<<"Yes";
}

这程序好像有点Bug,我给组数据试试?

详细

Test #1:

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

input:

3
1 2 -5

output:

Yes

result:

ok YES

Test #2:

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

input:

5
2 -5 2 3 1

output:

No

result:

ok NO

Test #3:

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

input:

5
3 -2 1 -1 -1

output:

Yes

result:

ok YES

Test #4:

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

input:

5
-1 100 100 100 100

output:

No

result:

ok NO

Test #5:

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

input:

5
3 -3 2 5 1

output:

No

result:

ok NO

Test #6:

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

input:

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

output:

No

result:

ok NO

Test #7:

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

input:

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

output:

Yes

result:

ok YES

Test #8:

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

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 NO

Test #9:

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

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 NO

Test #10:

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

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 NO

Test #11:

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

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 NO

Test #12:

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

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 NO

Test #13:

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

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 YES

Test #14:

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

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 YES

Test #15:

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

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 YES

Test #16:

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

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 YES

Test #17:

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

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 YES

Test #18:

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

input:

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

output:

Yes

result:

ok YES

Test #19:

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

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 NO

Test #20:

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

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 NO

Test #21:

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

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 NO

Test #22:

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

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 NO

Test #23:

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

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 NO

Test #24:

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

input:

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

output:

No

result:

ok NO

Test #25:

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

input:

1
1

output:

Yes

result:

ok YES

Test #26:

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

input:

1
0

output:

Yes

result:

ok YES

Test #27:

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

input:

1
-1

output:

Yes

result:

ok YES

Test #28:

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

input:

1
-20000

output:

Yes

result:

ok YES

Test #29:

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

input:

2
1 1

output:

Yes

result:

ok YES

Test #30:

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

input:

2
0 1

output:

No

result:

ok NO

Test #31:

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

input:

2
-1 1

output:

No

result:

ok NO

Test #32:

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

input:

2
1 -1

output:

Yes

result:

ok YES

Test #33:

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

input:

2
1 -2

output:

Yes

result:

ok YES

Extra Test:

score: 0
Extra Test Passed