QTABLE


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 493M

Problem type

Comments


  • -2
    10Tin_NguyenHuuNam  commented on Oct. 18, 2024, 3:56 a.m.

    include <bits/stdc++.h>

    define fi first

    define se second

    define pb push_back

    define fr(i,a,b) for(int i=a;i<=b;i++)

    define fd(i,a,b) for(int i=a;i>=b;i--)

    define UB upper_bound

    define LB lower_bound

    define mativado ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

    typedef long long ll; using namespace std; int const N=1000000+5; ll n,m,k,l,r; int main() { cin>>n>>m; int a[n+1][m+1]; fr (i,1,n) fr (j,1,m) cin>>a[i][j]; cin>>k; while (k--) { cin>>l>>r; int ok=0; fr (j,1,m) { int d=0; fr (i,l,r-1) if (a[i][j]>a[i+1][j]) d=1; if (d==0) {ok=1;break;} } if (ok==1) cout<<"Yes"<<'\n'; else cout<<"No"<<'\n'; } }


  • -2
    10Tin_NguyenHuuNam  commented on Oct. 18, 2024, 3:56 a.m.

    include <bits/stdc++.h>

    define fi first

    define se second

    define pb push_back

    define fr(i,a,b) for(int i=a;i<=b;i++)

    define fd(i,a,b) for(int i=a;i>=b;i--)

    define UB upper_bound

    define LB lower_bound

    define mativado ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

    typedef long long ll; using namespace std; int const N=1000000+5; ll n,m,k,l,r; int main() { cin>>n>>m; int a[n+1][m+1]; fr (i,1,n) fr (j,1,m) cin>>a[i][j]; cin>>k; while (k--) { cin>>l>>r; int ok=0; fr (j,1,m) { int d=0; fr (i,l,r-1) if (a[i][j]>a[i+1][j]) d=1; if (d==0) {ok=1;break;} } if (ok==1) cout<<"Yes"<<'\n'; else cout<<"No"<<'\n'; } }