QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#239311#6564. Frequent Flierpeddap#WA 0ms3504kbC++14980b2023-11-04 20:01:482023-11-04 20:01:49

Judging History

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

  • [2023-11-04 20:01:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3504kb
  • [2023-11-04 20:01:48]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
#define ll long long
#define vi vector

using namespace std;

int32_t main() {

    int n, m, k; cin >> n >> m >> k;
    vector<int> arr(n + m + m, 0);
    vector<int> chose(n + m + m, 0);
    for(int i=m; i<m+n; i++) cin >> arr[i];

    stack<int> st;

    int sum = 0;
    int ptr1 = 0;
    int ptr2 = m-1;


    for(;ptr2<n+m+m-1;) {
        sum -= chose[ptr1];
        ptr2++;
        st.push(ptr2);
        ptr1++;
        while(sum < k && !st.empty()) {
            int last = st.top();
            if(last < ptr1) break;

            int check = arr[last] - chose[last];
            int needed = k-sum;
            sum += min(needed, check);
            if(needed < check) {
                chose[last] += needed;
            } else {
                chose[last] = arr[last];
                st.pop();
            }
        }
    }

    int result = 0;
    cout << result << endl;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3504kb

input:

8 3 2
3
1
4
1
5
9
2
6

output:

0

result:

wrong answer 1st lines differ - expected: '8', found: '0'