QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#418734 | #6691. Orders | chenxii | WA | 0ms | 3840kb | C++14 | 812b | 2024-05-23 15:26:41 | 2024-05-23 15:26:41 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
const int N=1e3+10;
void solve(){
int n,k;cin>>n>>k;
map<int,int>ac;
int date=0;
for(int i=1;i<=n;i++){
int a,b;cin>>a>>b;ac[a]+=b;
date=max(a,date);
}
int cnt=0;bool flag=0;
for(int i=1;i<=date;i++){
cnt+=k;
if(ac[i]>cnt){flag=1;return;}
else cnt-=ac[i];
}
/*
while(ac[i].day==i){
//cout<<i<<endl<<endl;
if(cnt<ac[i].goods){flag=1;}
else {cnt-=ac[i].goods;}i++;
}
*/
if(flag){cout<<"NO"<<endl;}
else cout<<"YES"<<endl;
}
int main(void){
IOS
int t=1;
cin>>t;
while(t--){
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3840kb
input:
2 4 5 6 12 1 3 6 15 8 1 3 100 3 200 4 300 6 100
output:
YES
result:
wrong answer Answer contains longer sequence [length = 2], but output contains 1 elements