QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#244553#7728. RamenYcfhnndWA 1ms3500kbC++20602b2023-11-09 11:37:452023-11-09 11:37:45

Judging History

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

  • [2023-11-09 11:37:45]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3500kb
  • [2023-11-09 11:37:45]
  • 提交

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: 0ms
memory: 3400kb

input:

3
1 2 -5

output:

Yes

result:

ok YES

Test #2:

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

input:

5
2 -5 2 3 1

output:

No

result:

ok NO

Test #3:

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

input:

5
3 -2 1 -1 -1

output:

Yes

result:

ok YES

Test #4:

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

input:

5
-1 100 100 100 100

output:

No

result:

ok NO

Test #5:

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

input:

5
3 -3 2 5 1

output:

No

result:

ok NO

Test #6:

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

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: 3424kb

input:

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

output:

No

result:

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