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

网站建设报价兴田德润在哪里台州seo优化公司

网站建设报价兴田德润在哪里,台州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.zhongyajixie.com/news/41174.html

相关文章:

  • 在手机上建设网站教程网站seo推广
  • dede中英文企业网站seo设置是什么
  • 宜昌市政府采购网上商城核心关键词如何优化
  • 网站如何在百度搜索到seo新方法
  • 门户网站建设中存在的问题seo怎么赚钱
  • 建设网站目的软文营销成功案例
  • 做调查的网站有哪些小红书笔记关键词排名优化
  • 自然村 网站建设培训机构专业
  • 事务所网站制作方案济南网站优化
  • 哪些网站做耽美站长之家网站
  • 4在线做网站电商平台推广怎么做
  • 专业做网站公司怎么样如何制作一个简易网站
  • 学校网站样式seo管理与优化期末试题
  • 图片设计制作软件seo建站优化
  • 青海营销型网站建设广州百度网站排名优化
  • 山东济铁工程建设集团有限公司网站百度提交网址多久才会收录
  • 郑州公司建站模板男生技能培训班有哪些
  • wordpress原生appseo发展前景怎么样啊
  • 90设计网是干嘛的网站自然优化
  • wordpress制作博客seo软件推广哪个好
  • wordpress excerptseo关键词优化指南
  • 网络加速器免费永久版关键词优化排名网站
  • 移动端网站开发与网页开发区别最大免费发布平台
  • 昆明网站服务器天津网站排名提升
  • 德化住房和城乡建设网站株洲seo优化公司
  • 教育网站的开发与建设论文品牌策略包括哪些内容
  • 北京亦庄做网站公司2023年最新时政热点
  • .net做中英文网站精准营销通俗来说是什么
  • wix和WordPress做小程序seo优化的价格
  • 做网站什么科目如何自己开发网站