QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#804580#9873. Last Chance: Threads of Despairucup-team139#WA 0ms3728kbC++23623b2024-12-08 00:32:202024-12-08 00:32:21

Judging History

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

  • [2024-12-08 00:32:21]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3728kb
  • [2024-12-08 00:32:20]
  • 提交

answer

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

void solve([[maybe_unused]] int t)
{
  int n, m;
  cin >> n >> m;

  vector<long long> a(n), b(m);
  for (auto &i : a)
    cin >> i;
  for (auto &i : b)
    cin >> i;

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  long long val = -1;
  for (int i = 0; i < n; i++)
    val -= a[i] - 1;
  for (int i = 0; i < m; i++)
    val += max(0ll, b[i] - n - i);

  cout << (val > 0 ? "No" : "Yes") << "\n";
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n = 1;
  cin >> n;
  for (int i = 1; i <= n; i++)
    solve(i);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
3 2
1 1 4
2 6
3 2
1 1 4
2 7
2 1
100 100
2

output:

Yes
Yes
Yes

result:

wrong answer expected NO, found YES [2nd token]