当前位置: 首页 > news >正文

广东网页制作与网站建设app网络推广公司

广东网页制作与网站建设,app网络推广公司,男女做男个真实视频网站,新网站怎么做网络推广题目链接如下: Online Judge 首先,我的代码虽然AC了,但是是有问题的,uva的测试数据太水了所以侥幸通过而已。因为题目要求的数据是实数而非整数,我的代码是按所有数据都是整数来暴力做的……但因为刘汝佳的代码写得太…

题目链接如下:

Online Judge

首先,我的代码虽然AC了,但是是有问题的,uva的测试数据太水了所以侥幸通过而已。因为题目要求的数据是实数而非整数,我的代码是按所有数据都是整数来暴力做的……但因为刘汝佳的代码写得太好了,我就懒得再抄一遍了;所以就把自己有问题的代码贴在这里。

正确的解法在这里(也是刘汝佳的思路):UVA ~ 221 ~ Urban Elevations (离散化)-CSDN博客

#include <cstdio>
#include <vector>
#include <algorithm>
#include <set>
// #define debug
const int maxx = 1000000;struct building{int x, y, width, depth, height, number;building(){}building(int _x, int _y, int _width, int _depth, int _height): x(_x), y(_y), width(_width), depth(_depth), height(_height){}
};
int n, x, y, width, depth, height, kase = 0;
std::vector<building> vec;
std::vector<int> ans[maxx];bool cmp1(const int &a, const int &b){return vec[a - 1].y < vec[b - 1].y;
}bool cmp2(const int &a, const int &b){return vec[a - 1].x != vec[b - 1].x ? vec[a - 1].x < vec[b - 1].x : (vec[a - 1].y < vec[b - 1].y);
}int main(){#ifdef debugfreopen("1.txt", "r", stdin);freopen("2.txt", "w", stdout);#endifwhile(scanf("%d", &n) == 1 && n){printf("%s", kase ? "\n" : "");printf("For map #%d, the visible buildings are numbered as follows:\n", ++kase);std::vector<int> tmp;fill(ans, ans + maxx, tmp);int maxWidth = 0;int minWidth = 10000000;vec.clear();for(int i = 1; i <= n; ++i){scanf("%d %d %d %d %d", &x, &y, &width, &depth, &height);vec.push_back(building(x, y, width, depth, height));vec.back().number = i;maxWidth = std::max(maxWidth, x + width);minWidth = std::min(minWidth, x);for(int j = x; j < x + width; ++j){ans[j].push_back(i);}}for(int i = minWidth; i < maxWidth; ++i){sort(ans[i].begin(), ans[i].end(), cmp1);int height = 0;for(int j = 0; j < ans[i].size(); ++j){if(vec[ans[i][j] - 1].height > height){height = vec[ans[i][j] - 1].height;} else{ans[i][j] = 0;}}}std::vector<int> res;std::set<int> st;for(int i = minWidth; i < maxWidth; ++i){for(int j = 0; j < ans[i].size(); ++j){if(ans[i][j] && st.find(ans[i][j]) == st.end()){res.push_back(ans[i][j]);st.insert(ans[i][j]);}}}sort(res.begin(), res.end(), cmp2);for(int i = 0; i < res.size(); ++i){printf("%d%s", res[i], i == res.size() - 1 ? "\n" : " ");}}#ifdef debugfclose(stdin);fclose(stdout);#endifreturn 0;
}

http://www.dinnco.com/news/85034.html

相关文章:

  • 工信部备案网站打不开全网整合营销公司
  • 合肥做公司网站公司广州品牌营销服务
  • 中国建设银行网站党建seo案例分析
  • 做网站功能模块营销方式和渠道有哪些
  • 文化集团网站模板全国人大常委会
  • 广告公司网站建设网络视频营销的案例
  • 网站维护推广表设计师经常用的网站
  • 查询商品价格走势的网站百度推广自己怎么做
  • 天津自贸区建设局网站网站模板大全
  • 阿里云ecs建网站百度外推排名代做
  • 介绍自己的做的网站怎么进行网络营销
  • 优质企业网站建设新手如何做网上销售
  • wordpress主题结合seo具体怎么优化
  • 怎样网页制作优化加速
  • 河北省建设执业资格注册管理中心网站写一篇推广商品的软文
  • 安徽网站定制网站页面优化方案
  • 在线正能量网站地址链接免费网络推广工具
  • wordpress文章签名插件网站seo分析常用的工具是
  • wap网站建设方案 pdf网上广告宣传怎么做
  • 用jsp做网站登录界面模板网络公司网站
  • 杭州外贸网站建设公司上海网站seo排名优化
  • 漳州网站建设公司首选网络营销服务工具
  • 网站 域名解析错误培训班线上优化
  • 学校网站建设的意见建站公司哪家好
  • 做网站是怎么做的百度一下 你就知道首页官网
  • 做网站运用的软件南京最大网站建设公司
  • 网站开发快递文件免费网络推广平台有哪些
  • 安徽网站建设产品介绍百度推广基木鱼
  • 公司网站怎样实名认证免费搭建网站
  • 无经验能做sem专员江北seo页面优化公司