QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#806600 | #9873. Last Chance: Threads of Despair | 123sadasdasd | WA | 0ms | 3796kb | C++14 | 742b | 2024-12-09 12:45:37 | 2024-12-09 12:45:38 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n,m;
cin >> n >> m;
vector<long long>v1;
vector<long long>v2;
for(int i = 1;i <= n;i++){
long long c;
cin >> c;
v1.push_back(c);
}
for(int j = 1;j <= m;j++){
long long c;
cin >> c;
v2.push_back(c);
}
int p = 0;
while(p < n && v1[p] == 1){
p++;
}
long long total;
long long pop = p;
if(p == 0)
total = n;
else
total = n - p + 1;
for(int i = 0;i < m;i++){
while(p < n && v1[p] <= pop + 1){
pop++;
p++;
}
total -= max(0ll,v2[i] - pop);
pop++;
}
if(total >= 0)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3564kb
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: 3572kb
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: 3504kb
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: 3796kb
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: -100
Wrong Answer
time: 0ms
memory: 3780kb
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 No Yes Yes No Yes Yes No Yes Yes No Yes Yes No
result:
wrong answer expected YES, found NO [6th token]