QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#245189 | #4269. Rainy Markets | rsg23 | 0 | 3ms | 13892kb | C++14 | 792b | 2023-11-09 19:41:00 | 2023-11-09 19:41:01 |
Judging History
answer
#include <iostream>
#include <queue>
#include <algorithm>
#include <vector>
using namespace std;
const int NR = 1e6 + 5;
int n, a[NR], b[NR], c[NR], d[NR], e[NR], f[NR];
signed main() {
ios :: sync_with_stdio(false), cin.tie(0);
cin >> n;
for (int i = 1; i <= n; ++i) cin >> a[i];
for (int i = 1; i < n; ++i) cin >> b[i];
for (int i = 1; i < n; ++i) cin >> c[i];
for (int i = 1; i < n; ++i) e[i] = min(b[i], c[i]), b[i] -= e[i];
d[1] = min(b[1], a[1]), b[1] -= d[1];
for (int i = 1; i < n; ++i) {
if (a[i + 1] < b[i]) return cout << "NO\n", 0;
f[i] = b[i], a[i + 1] -= b[i];
d[i + 1] = min(b[i + 1], a[i + 1]), b[i + 1] -= d[i + 1];
}
cout << "YES\n";
for (int i = 1; i < n; ++i) cout << d[i] << ' ' << e[i] << ' ' << f[i] << '\n';
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 5
Accepted
time: 3ms
memory: 13792kb
input:
3 10 15 10 20 20 0 0
output:
NO
result:
ok IMPOSSIBLE
Test #2:
score: -5
Wrong Answer
time: 0ms
memory: 13820kb
input:
2 813741488 132495829 946237313 0
output:
YES 813741488 0 132495825
result:
wrong answer the cost you declared is 813741488, but expected 0
Subtask #2:
score: 0
Wrong Answer
Test #36:
score: 0
Wrong Answer
time: 2ms
memory: 13892kb
input:
3 10 15 10 20 20 0 11
output:
YES 10 0 10 5 11 4
result:
wrong answer the cost you declared is 10, but expected 5
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Skipped
Dependency #1:
0%