QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#133362#4269. Rainy MarketsHunterXD#0 1ms3592kbC++14964b2023-08-02 02:18:052024-07-04 01:10:16

Judging History

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

  • [2024-07-04 01:10:16]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3592kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-08-02 02:18:05]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;

#define all(x) x.begin(), x.end()

const char nd = '\n';

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  //

  ll n;
  cin >> n;

  vl b(n);
  for (auto &v : b) cin >> v;

  vl p(n, 0);
  for (ll i = 0; i + 1 < n; i++) cin >> p[i];

  vl u(n, 0);
  for (ll i = 0; i + 1 < n; i++) cin >> u[i];

  vl used(n, 0), market(n, 0);

  bool can = true;
  ll free = 0;

  for (ll i = n - 1; i >= 0; i--) {
    used[i] = max(p[i] - free, 0LL);
    if (used[i] <= b[i]) {
      free = b[i] - used[i];
    } else {
      can = false;
      break;
    }
  }

  if (!can) {
    cout << "NO" << nd;
    return 0;
  }

  cout << "YES" << nd;

  for (ll i = 0; i + 1 < n; i++) {
    cout << market[i] << " " << used[i] << " " << p[i] - used[i] - market[i]
         << nd;
  }
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 5
Accepted
time: 0ms
memory: 3592kb

input:

3
10 15 10
20 20
0 0

output:

NO

result:

ok IMPOSSIBLE

Test #2:

score: 0
Wrong Answer
time: 1ms
memory: 3552kb

input:

2
813741488 132495829
946237313
0

output:

YES
0 813741484 132495829

result:

wrong output format Unexpected end of file - int32 expected

Subtask #2:

score: 0
Wrong Answer

Test #36:

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

input:

3
10 15 10
20 20
0 11

output:

NO

result:

wrong answer read 'NO' but expected 'YES'

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%