提交时间:2024-01-07 13:36:04

运行 ID: 229889

#include<bits/stdc++.h> using namespace std; int a[102]; int main(){ int t; cin>>t; for(int i=1;i<=t;i++){ int b,s; cin>>b>>s; for(int j=1;j<=b;j++){ cin>>a[j]; } for(int j=1;j<=s;j++){ int d,f; cin>>d>>f; a[d]++; a[f]--; } bool f=false; for(int j=2;j<=b;j++){ if(a[j]<a[j-1]){ f=true; break; } } if(f==true){ cout<<"No"<<endl; } else{ cout<<"Yes"<<endl; } } return 0; }