QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#226680 | #4837. Ramen | JerryBlack_ZJNU | WA | 0ms | 3776kb | C++20 | 898b | 2023-10-26 13:34:51 | 2023-10-26 13:34:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define fi first
#define se second
#define lowbit(x) (x&(-x))
const int mod=998244353;
const double eps=1e-12;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
#define popcnt __builtin_popcount
int dcmp(double x){if(fabs(x)<eps)return 0;return x>0?1:-1;}
#define int ll
void solve()
{
int n;
cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++)cin>>a[i];
int sum=0;
for(int i=1;i<n;i++)
{
sum+=a[i];
if(sum<0)
{
cout<<"NO\n";
return;
}
}
cout<<"YES\n";
}
/*
*/
#undef int
int main()
{
ios::sync_with_stdio(false);cin.tie(nullptr);
// cout<<fixed<<setprecision(15);
// int _;cin>>_;while(_--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3524kb
input:
3 1 2 -5
output:
YES
result:
ok answer is YES
Test #2:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
5 2 -5 2 3 1
output:
NO
result:
ok answer is NO
Test #3:
score: 0
Accepted
time: 0ms
memory: 3524kb
input:
5 3 -2 1 -1 -1
output:
YES
result:
ok answer is YES
Test #4:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
5 -1 100 100 100 100
output:
NO
result:
ok answer is NO
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
5 3 -3 2 5 1
output:
YES
result:
wrong answer expected NO, found YES