日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

cf777c

發布時間:2023/12/13 编程问答 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 cf777c 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

題意:給你一個n*m的數陣 對于一行到另一行,若存在一列從上到下遞減,則稱之符合題意
The first line of the input contains two positive integers n and m (1?≤?n·m?≤?100?000) — the number of rows and the number of columns in the table respectively. Note that your are given a constraint that bound the product of these two integers, i.e. the number of elements in the table.

Each of the following n lines contains m integers. The j-th integers in the i of these lines stands for ai,?j (1?≤?ai,?j?≤?109).The next line of the input contains an integer k (1?≤?k?≤?100?000) — the number of task that teacher gave to Alyona.The i-th of the next k lines contains two integers li and ri (1?≤?li?≤?ri?≤?n). 以上是數據范圍

a【】來存儲每一行的數
b【】來存儲每一列能到達的最上行
在用c【】來存儲每一行能到達的最上行

#include<cstdio> using namespace std; int a[100005],b[100005],c[100005]; int main() {int n,m,x,i,j,r,l,k;scanf("%d%d",&n,&m);for(i=1;i<=m;i++)b[i]=1;for(i=1;i<=n;i++){c[i]=i; for(j=1;j<=m;j++){scanf("%d",&x);if(x<a[j])b[j]=i;a[j]=x; if(b[j]<c[i]) c[i]=b[j];}}scanf("%d",&k);while(k--){scanf("%d%d",&r,&l);if(c[l]<=r)printf("Yes\n");elseprintf("No\n");}return 0; }


思路:由于有多次詢問所以先打表,記錄每一行所能到達的最上行即可

轉載于:https://www.cnblogs.com/pot-a-to/p/10937035.html

總結

以上是生活随笔為你收集整理的cf777c的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。