QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#241775 | #7728. Ramen | invaded | WA | 6ms | 3604kb | C++17 | 1.8kb | 2023-11-06 17:08:41 | 2023-11-06 17:08:42 |
Judging History
answer
#include<bits/stdc++.h>
#ifndef xxx
#define dbg(...) ;
#endif
using namespace std;
template<class T> ostream &operator<<(ostream &o, const vector <T> &v) { bool f=false; for(T i:v) { f?o<<' ':o; o<<(i); f=true; } return o; }
template<class T> void sort(T &v) { std::sort(v.begin(), v.end()); }
template<class T, class C> void sort(T &v, C c) { std::sort(v.begin(), v.end(), c); }
template<class T> void reverse(T &v) { std::reverse(v.begin(), v.end()); }
template<class T> bool is_sorted(T &v) { return std::is_sorted(v.begin(), v.end()); }
template<class T> inline void _min(T &x, const T &y) { x>y?x=y:x; }
template<class T> inline void _max(T &x, const T &y) { x<y?x=y:x; }
istream &operator>>(istream &i, __int128_t &x) { x=0; short f=1; char c=0; while(!isdigit(c)) { if(c=='-')f=-1; c=i.get(); } while(isdigit(c))x=x*10+c-'0', c=i.get(); x*=f; return i; }
ostream &operator<<(ostream &o, __int128_t x) { if(x==0) { o<<0; return o; } bool f=false; string s; if(x<0)f=true, x=-x; while(x)s+=x%10+'0', x/=10; reverse(s); if(f)o<<'-'; o<<s; return o; }
mt19937 mt(time(0));
typedef double db;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
constexpr int maxn=2e5+5;
constexpr int mod=1e9+7;
constexpr int inf=0x3f3f3f3f;
constexpr ll INF=0x3f3f3f3f3f3f3f3fll;
constexpr double pi=acos(-1.0);
constexpr double eps=1e-9;
int main()//MARK: main
{
#ifndef xxx
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
#endif
cout<<fixed<<setprecision(10);
int n;
cin>>n;
int sum=0;
bool flag=true;
for(int i=1; i<=n; i++)
{
int x;
cin>>x;
if(i>=1&&i<n&&x<0)
{
if(sum+x<=0)
{
flag=false;
}
}
sum+=x;
}
cout<<(flag?"Yes":"No")<<'\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3560kb
input:
3 1 2 -5
output:
Yes
result:
ok YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3528kb
input:
5 2 -5 2 3 1
output:
No
result:
ok NO
Test #3:
score: 0
Accepted
time: 0ms
memory: 3504kb
input:
5 3 -2 1 -1 -1
output:
Yes
result:
ok YES
Test #4:
score: 0
Accepted
time: 0ms
memory: 3516kb
input:
5 -1 100 100 100 100
output:
No
result:
ok NO
Test #5:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 3 -3 2 5 1
output:
No
result:
ok NO
Test #6:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
10 1 2 3 4 5 -15 100 200 300 100
output:
No
result:
ok NO
Test #7:
score: 0
Accepted
time: 1ms
memory: 3588kb
input:
10 1 2 3 4 5 -14 100 200 300 100
output:
Yes
result:
ok YES
Test #8:
score: 0
Accepted
time: 6ms
memory: 3460kb
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: 6ms
memory: 3568kb
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: 6ms
memory: 3512kb
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: 6ms
memory: 3512kb
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: 6ms
memory: 3536kb
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: 5ms
memory: 3508kb
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: 2ms
memory: 3576kb
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: 5ms
memory: 3520kb
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: 5ms
memory: 3456kb
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: 2ms
memory: 3592kb
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: 1ms
memory: 3532kb
input:
10 6451 4281 -4304 3221 -5221 -607 3277 -4342 -1157 -8248
output:
Yes
result:
ok YES
Test #19:
score: 0
Accepted
time: 6ms
memory: 3604kb
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: 6ms
memory: 3516kb
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: 6ms
memory: 3452kb
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: 6ms
memory: 3568kb
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: 2ms
memory: 3512kb
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: 1ms
memory: 3516kb
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: 3456kb
input:
1 1
output:
Yes
result:
ok YES
Test #26:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
1 0
output:
Yes
result:
ok YES
Test #27:
score: 0
Accepted
time: 0ms
memory: 3532kb
input:
1 -1
output:
Yes
result:
ok YES
Test #28:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
1 -20000
output:
Yes
result:
ok YES
Test #29:
score: 0
Accepted
time: 0ms
memory: 3480kb
input:
2 1 1
output:
Yes
result:
ok YES
Test #30:
score: -100
Wrong Answer
time: 1ms
memory: 3592kb
input:
2 0 1
output:
Yes
result:
wrong answer expected NO, found YES [1st token]