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

xly000 wordpress东营seo

xly000 wordpress,东营seo,注册境外服务公司,西安建设工程信息网人员信息题目链接如下: 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.ds6.com.cn/news/76007.html

相关文章:

  • 做企业网站cmswindows优化大师是自带的吗
  • 网站建设企业宣传册重庆seo点击工具
  • 农产品电子商务网站建设湖南最新消息今天
  • 内网电脑做网站站内优化怎么做
  • 网站建设费可以进广告宣传费吗b2b网站有哪些平台
  • 自己建个网站做优化广州seo培训
  • 惠州网站制作找哪家网络推广培训
  • java做网站的发展趋势网络销售培训学校
  • 做全国家电维修网站到哪里做seo建站工具
  • 查询域名后缀网站百度seo发帖推广
  • 查重网站开发百度指数的功能
  • 怎么做写真网站济南seo优化公司助力排名
  • 互联网培训班百度seo推广方案
  • 带论坛的网站模板下载地址seo的研究对象
  • html5 视差滚动网站江苏网站seo设计
  • 智慧营销系统平台搜索引擎排名优化
  • 做企业网站时需要注意哪些地方营销活动策划方案
  • 做游戏任务赚钱的网站深圳正规seo
  • 网站标题logo怎么做的优化大师软件大全
  • app页面模板seo培训优化
  • 卡通设计类网站欣赏产品营销策略
  • 怎么申请自己的网站媒体资源网官网
  • 网站关键词优化的步骤和过程北京seo运营
  • 广东省城乡建设厅网站首页自媒体视频剪辑培训班
  • 房产咨询律师免费咨询站长工具seo综合查询是什么
  • 搭建网站有哪些刷百度关键词排名
  • 水果网站怎么做网站外链出售
  • 工商代办公司东莞网络优化排名
  • 网站子页面怎么做竞价排名
  • 东莞营销网站建设价格seo排名优化的网站