博客
关于我
HDU 5480
阅读量:149 次
发布时间:2019-02-27

本文共 1606 字,大约阅读时间需要 5 分钟。

??????????????????????????????????????????????????????????????????????????????

????

  • ????:

    • ???????????????
    • ??????????????????????????
  • ?????:

    • ???????????????????????
    • row_prefix[i] ???i???????
    • col_prefix[i] ???i???????
  • ????:

    • ??????????????????????????
    • ???????????????"Yes"?????"No"?
  • ????

    #include 
    #include
    using namespace std;int main() { int T; cin >> T; for (int _t = 0; _t < T; ++_t) { int n, m, K, Q; cin >> n >> m >> K >> Q; vector
    row_exists(n + 2, 0); vector
    col_exists(m + 2, 0); for (int _k = 0; _k < K; ++_k) { int a, b; cin >> a >> b; row_exists[a] = 1; col_exists[b] = 1; } vector
    row_prefix(n + 2, 0); for (int i = 1; i <= n; ++i) { row_prefix[i] = row_prefix[i-1] + row_exists[i]; } vector
    col_prefix(m + 2, 0); for (int i = 1; i <= m; ++i) { col_prefix[i] = col_prefix[i-1] + col_exists[i]; } for (int _q = 0; _q < Q; ++_q) { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; bool has_row = (row_prefix[x2] - row_prefix[x1-1]) > 0; bool has_col = (col_prefix[y2] - col_prefix[y1-1]) > 0; if (has_row || has_col) { cout << "Yes"; } else { cout << "No"; } } } return 0;}

    ????

  • ????:

    • ????????T?
    • ???????????n, m, K, Q?
    • ???????row_exists?col_exists????????
  • ??????:

    • ????????????????????1?
  • ???????:

    • ??row_prefix?col_prefix?????????????????
  • ????:

    • ??????????????????????
    • ?????????????
  • ?????????????????????????????O(1)????????????

    转载地址:http://xiib.baihongyu.com/

    你可能感兴趣的文章
    QueryPerformanceCounter与QueryPerformanceFrequency
    查看>>
    Plaid.com的监控系统如何实现与9600多家金融机构的集成
    查看>>
    Plain Stock Prediction:基于RNN的股票价格预测工具
    查看>>
    platform_driver与file_operations两种方法开发led驱动
    查看>>
    PlatON共识方案详解:应用CBFT共识协议,提高共识效率
    查看>>
    QueryDict和模型表知识补充
    查看>>
    Querybase 使用与安装教程
    查看>>
    Playwright与Selenium的对比:谁是更适合你的自动化测试工具?
    查看>>
    quarz设置定时器任务的有效时间段_定时器?你知道有几种实现方式吗?
    查看>>
    PLC、DCS、SCADA的选型
    查看>>
    PLC中的电子凸轮的简单介绍
    查看>>
    PLC发展详解-ChatGPT4o作答+匹尔西
    查看>>
    PLC探针有什么用
    查看>>
    PLC接线详解
    查看>>
    PLC数组的使用(西门子)
    查看>>
    Quarzt定时调度任务
    查看>>
    SpringBoot之AOP详解
    查看>>
    PLC结构体(西门子)
    查看>>
    PLC编程语言ST文本语法的常用数据类型及变量
    查看>>