QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244545#7728. RamenYcfhnndWA 1ms3520kbC++20601b2023-11-09 11:33:102023-11-09 11:33:11

Judging History

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

  • [2023-11-09 11:33:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3520kb
  • [2023-11-09 11:33:10]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

void solve(){
    int n;
    cin >> n;
    vector<int>a(n + 2);
    for (int i = 1;i <= n;i ++){
        cin >> a[i];
    }
    vector<int>s(n + 2);
    for (int i = n;i >= 1;i --){
        s[i] = s[i + 1] + a[i];
        if (s[i] < 0){
            cout << "Yes\n";
            return;
        }
    }
    cout << "No\n";

}       

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int T = 1;
    // cin >> T;
    while (T--) {
        solve();    
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3424kb

input:

3
1 2 -5

output:

Yes

result:

ok YES

Test #2:

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

input:

5
2 -5 2 3 1

output:

No

result:

ok NO

Test #3:

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

input:

5
3 -2 1 -1 -1

output:

Yes

result:

ok YES

Test #4:

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

input:

5
-1 100 100 100 100

output:

No

result:

ok NO

Test #5:

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

input:

5
3 -3 2 5 1

output:

No

result:

ok NO

Test #6:

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

input:

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

output:

No

result:

ok NO

Test #7:

score: -100
Wrong Answer
time: 0ms
memory: 3404kb

input:

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

output:

No

result:

wrong answer expected YES, found NO [1st token]