QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#239311 | #6564. Frequent Flier | peddap# | WA | 0ms | 3504kb | C++14 | 980b | 2023-11-04 20:01:48 | 2023-11-04 20:01:49 |
Judging History
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;
}
詳細信息
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'