QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#554400#8777. Passport Stampschengning0909WA 4ms5140kbC++14589b2024-09-09 11:01:132024-09-09 11:01:13

Judging History

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

  • [2024-09-09 11:01:13]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:5140kb
  • [2024-09-09 11:01:13]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int N = 1e5 + 10;
const ll INF = 2e18;

int n;
ll p, a[N], mmin[N];
__int128 tp;

int main() {
    ios::sync_with_stdio(0), cin.tie(0);
    cin >> n >> p;
    for (int i = 1; i <= n; i++) cin >> a[i];
    mmin[n + 1] = INF;
    for (int i = n; i >= 1; i--) mmin[i] = min(mmin[i + 1], a[i]);

    for (int i = 1; i <= n; i++) {
        if (tp + mmin[i + 1] > p) {
            cout << i - 1; return 0;
        }
        tp += mmin[i + 1] + a[i] - 1;
    }
    cout << n;
    return 0;
}

詳細信息

Test #1:

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

input:

5 15
1
2
3
4
5

output:

3

result:

ok single line: '3'

Test #2:

score: -100
Wrong Answer
time: 4ms
memory: 5140kb

input:

100000 559309580160692839
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

84438

result:

wrong answer 1st lines differ - expected: '84437', found: '84438'