QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#418734#6691. OrderschenxiiWA 0ms3840kbC++14812b2024-05-23 15:26:412024-05-23 15:26:41

Judging History

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

  • [2024-05-23 15:26:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3840kb
  • [2024-05-23 15:26:41]
  • 提交

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