提交时间:2024-01-07 13:54:42
运行 ID: 229920
#include <iostream> using namespace std; int a[1002]; int main() { int t; cin>>t; for(int i = 1;i <= t;i++) { int n,k; cin>>n>>k; for(int j = 1;j <= n;j++) { cin>>a[j]; } for(int j = 1;j <= k;j++) { int u,d; cin>>u>>d; a[u]++; a[d]--; } bool panda = true; for(int j = 1;j < n;j++) { if(a[j]>a[j+1])//降序为false { panda = false; } } if(panda == true) { cout<<"Yes"<<endl; } else { cout<<"No"<<endl; } } return 0; }