博客
关于我
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/

    你可能感兴趣的文章
    Nginx的Rewrite正则表达式,匹配非某单词
    查看>>
    Nginx的使用总结(一)
    查看>>
    Nginx的可视化神器nginx-gui的下载配置和使用
    查看>>
    Nginx的是什么?干什么用的?
    查看>>
    Nginx访问控制_登陆权限的控制(http_auth_basic_module)
    查看>>
    nginx负载均衡器处理session共享的几种方法(转)
    查看>>
    nginx负载均衡的5种策略(转载)
    查看>>
    nginx负载均衡的五种算法
    查看>>
    Nginx运维与实战(二)-Https配置
    查看>>
    Nginx配置ssl实现https
    查看>>
    Nginx配置TCP代理指南
    查看>>
    Nginx配置——不记录指定文件类型日志
    查看>>
    Nginx配置代理解决本地html进行ajax请求接口跨域问题
    查看>>
    Nginx配置参数中文说明
    查看>>
    Nginx配置好ssl,但$_SERVER[‘HTTPS‘]取不到值
    查看>>
    Nginx配置实例-负载均衡实例:平均访问多台服务器
    查看>>
    NIFI大数据进阶_连接与关系_设置数据流负载均衡_设置背压_设置展现弯曲_介绍以及实际操作---大数据之Nifi工作笔记0027
    查看>>
    NIO ByteBuffer实现原理
    查看>>
    Nio ByteBuffer组件读写指针切换原理与常用方法
    查看>>
    NIO Selector实现原理
    查看>>