QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#808193 | #9873. Last Chance: Threads of Despair | lzz | WA | 0ms | 3844kb | C++17 | 2.0kb | 2024-12-10 17:48:52 | 2024-12-10 17:49:00 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define my_ind 2
#define other_ind 1
void sol()
{
int n, m;
cin >> n >> m;
// val, type
// vector<pair<int, int>> vec;
vector<int> my_hp_vec;
int can_do = 0;
int one_cnt = 0;
for (int i = 0; i < n; i++)
{
int num;
cin >> num;
if(num > 1)
{
my_hp_vec.push_back(num - 1);
can_do++;
}
else
{
my_hp_vec.push_back(num);
one_cnt++;
}
}
vector<int> void_vec;
int pmy = 0;
for(int i = 0; i < n + m; i++)
{
int ex_num = max(i, 1);
if(pmy < n && my_hp_vec[pmy] <= ex_num)
{
pmy++;
}
else
{
void_vec.push_back(max(i, 1));
}
}
vector<int> other_ex;
for (int i = 0; i < m; i++)
{
int num;
cin >> num;
other_ex.push_back(num);
}
sort(other_ex.begin(), other_ex.end());
int op = 0;
for (int i = 0; i < m; i++)
{
if(other_ex[i] > void_vec[i])
{
op += other_ex[i] - void_vec[i];
}
}
if(one_cnt == 0)
{
if(can_do >= op)
{
int yu = (can_do - op);
if(yu >= void_vec[0])
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
}
else
cout << "No\n";
}
else
{
if(can_do + 1 >= op)
cout << "Yes\n";
else if(can_do >= op)
{
int yu = (can_do - op + one_cnt);
if(yu >= void_vec[0])
{
cout << "Yes\n";
}
else
{
cout << "No\n";
}
}
else
cout << "No\n";
}
}
int main()
{
int T;
cin >> T;
while (T--)
{
sol();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3556kb
input:
3 3 2 1 1 4 2 6 3 2 1 1 4 2 7 2 1 100 100 2
output:
Yes No Yes
result:
ok 3 token(s): yes count is 2, no count is 1
Test #2:
score: 0
Accepted
time: 0ms
memory: 3776kb
input:
3 7 1 1 1 1 1 1 1 1 9 5 2 3 4 5 6 7 1 6 5 3 3 4 5 6 7 1 5 7
output:
No No Yes
result:
ok 3 token(s): yes count is 1, no count is 2
Test #3:
score: 0
Accepted
time: 0ms
memory: 3772kb
input:
4 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 2
output:
Yes Yes Yes No
result:
ok 4 token(s): yes count is 3, no count is 1
Test #4:
score: 0
Accepted
time: 0ms
memory: 3844kb
input:
18 1 2 1 1 1 1 2 1 2 1 1 2 1 1 3 1 2 1 2 2 1 2 1 3 2 1 2 1 3 3 1 2 2 1 1 1 2 2 1 2 1 2 2 1 3 1 2 2 2 2 1 2 2 2 3 1 2 2 3 3 1 2 3 1 1 1 2 3 1 2 1 2 3 1 3 1 2 3 2 2 1 2 3 3 2 1 2 3 3 3
output:
Yes Yes Yes Yes No No Yes Yes No No No No Yes No No No No No
result:
ok 18 token(s): yes count is 7, no count is 11
Test #5:
score: 0
Accepted
time: 0ms
memory: 3628kb
input:
18 2 1 1 1 1 2 1 1 1 2 2 1 1 1 3 2 1 1 2 1 2 1 2 1 2 2 1 2 1 3 2 1 1 3 1 2 1 1 3 2 2 1 3 1 3 2 1 2 2 1 2 1 2 2 2 2 1 2 2 3 2 1 2 3 1 2 1 3 2 2 2 1 2 3 3 2 1 3 3 1 2 1 3 3 2 2 1 3 3 3
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes No Yes Yes No
result:
ok 18 token(s): yes count is 15, no count is 3
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3620kb
input:
525 2 3 1 1 1 1 1 2 3 1 1 1 2 1 2 3 1 1 1 3 1 2 3 1 1 1 4 1 2 3 1 1 5 1 1 2 3 1 1 2 2 1 2 3 1 1 3 1 2 2 3 1 1 1 2 4 2 3 1 1 2 1 5 2 3 1 1 3 3 1 2 3 1 1 4 3 1 2 3 1 1 3 5 1 2 3 1 1 4 4 1 2 3 1 1 4 5 1 2 3 1 1 1 5 5 2 3 1 1 2 2 2 2 3 1 1 2 3 2 2 3 1 1 2 2 4 2 3 1 1 2 5 2 2 3 1 1 3 2 3 2 3 1 1 3 2 4 2 ...
output:
Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes Yes Yes Yes Yes Yes Yes No No Yes Yes No No No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes No No No No No No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ...
result:
wrong answer expected YES, found NO [82nd token]