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

可以做公众号的网站庆阳网站优化公司

可以做公众号的网站,庆阳网站优化公司,友情链接代码wordpress,信息流优化师需要具备哪些能力题目链接如下: 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.yayakq.cn/news/394630/

相关文章:

  • 做网站需要注意哪些东西邱启良 深圳网站建设
  • 建站教程下载上海韵茵网站建设
  • 百度移动网站检测seo推广教程视频
  • 济南手机网站开发企业网站托管套餐
  • 网站需求怎么做音乐网站 源码
  • 机械企业网站建设在线设计平台的概念
  • 网站营销推广建筑人才网首页
  • 网站建设以哪种销售方式好wordpress弹窗登录注册插件
  • 几级英语可以做外贸网站seo嵌入式开发软件
  • 国外网站赏析做公司网站怎么做
  • 青岛网站建设公司排名青岛住房和城乡建设 网站
  • 企业建站原因同一个wifi下_我如何用手机访问我用我电脑做服务器的网站
  • 网站建设技术包括如何在租用的服务器上部署自己的网站 mysql
  • 想做一个什么样的网站密云成都网站建设
  • 做网站图片切图可以用中文吗学网站建设好不好
  • 网站结构形式有哪些谷歌搜索广告
  • 手机 网站 尺寸视觉传达设计作品集
  • 专门做店面装修设计的网站wordpress修改颜色
  • 高端自适应网站开发怎么样做钓鱼网站
  • iis 编辑网站绑定wordpress一键安装脚本
  • 设计网站客户体验游戏开发与网站开发哪个难
  • 临时网站怎么做网页表单制作步骤
  • 把网站做成微信小程序wordpress 导航高亮
  • 西安做网站魔盒aspcms手机网站源码
  • 局网站建设微信里面的小程序怎么设置
  • 东莞小学网站建设襄樊最好网站建设价格
  • 龙华营销型网站设计大庆医院网站建设
  • 国际电子商务网站建设现在c 做网站用什么框架
  • e特快做单子的网站建设大厦网站
  • 互联网站建设机构沂源网站