Educational Codeforces Round 10
2016-04-10 22:17
453 查看
A:Gabriel and Caterpillar
题意:蜗牛爬树问题;值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1;
View Code
E:Pursuit For Artifacts
思路:强连通分量
智商太低,无法理解,还是滚去看书去了;
题解连接:
http://www.cnblogs.com/Recoder/p/5323546.html
F:Ants on a Circle
思路:先做了poj 1852再说;
题意:蜗牛爬树问题;值得一提的是在第n天如果恰好在天黑时爬到END,则恰好整除,不用再+1;
day = (End - Begin - day0)/(12*(up-down))+1;
#include <iostream> #include <algorithm> #include <cstdlib> #include <ctime> #include <cmath> #include <cstdio> #include <string> #include <cstring> #include <vector> #include <queue> #include <stack> #include <set> #define c_false ios_base::sync_with_stdio(false); cin.tie(0) #define INF 0x3f3f3f3f #define INFL 0x3f3f3f3f3f3f3f3f #define zero_(x,y) memset(x , y , sizeof(x)) #define zero(x) memset(x , 0 , sizeof(x)) #define MAX(x) memset(x , 0x3f ,sizeof(x)) #define swa(x,y) {LL s;s=x;x=y;y=s;} using namespace std ; #define N 200005 #define lowbit(k) k&(-k) const double PI = acos(-1.0); typedef long long LL ; struct BIT{int l, r, id;}; int bit ,ANS ,n; BIT num ; void update(int s, int k){ for(int j = s; j <= n; j +=lowbit(j)) bit[j] += k; } int query(int k){ int ans = 0; for(int i = k; i > 0; i -=lowbit(i)) ans += bit[i]; return ans; } bool compL(BIT a, BIT b){return a.l<b.l;} bool compR(BIT a, BIT b){return a.r<b.r;} int main(){ //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); //ios_base::sync_with_stdio(false); cin.tie(0); scanf("%d",&n); for(int i = 1; i <= n; i++){ scanf("%d%d", &num[i].l, &num[i].r); num[i].id = i; } sort(num+1, num+n+1, compR); //for(int i = 1; i <= n; i++) cout<<num[i].l<<" "<<num[i].r<<" "<<num[i].id<<endl; for(int i = 1; i <= n; i++) num[i].r = i; sort(num+1, num+n+1, compL); //for(int i = 1; i <= n; i++) cout<<num[i].l<<" "<<num[i].r<<" "<<num[i].id<<endl; for(int i = n;i>=1; i--){ ANS[num[i].id] = query(num[i].r); update(num[i].r, 1); } for(int i = 1; i <= n; i++) printf("%d\n", ANS[i]); return 0; }
View Code
E:Pursuit For Artifacts
思路:强连通分量
智商太低,无法理解,还是滚去看书去了;
题解连接:
http://www.cnblogs.com/Recoder/p/5323546.html
F:Ants on a Circle
思路:先做了poj 1852再说;
相关文章推荐
- stringstream的用法
- 第八届郑州轻工业学院ACM程序设计大赛校内预选赛
- 20160410感言
- CSS3_3D转换
- 自定义类MyThread 实现Runnable接口,主函数创建5个线程,自定义线程类的构造函数输出 创建线程X
- 承诺投入模型
- 读书笔记.:硝烟中的Scrum和XP
- PSobj [1] 炫光字体
- HTML5学习笔记二 HTML基础
- 20145328 《Java程序设计》第6周学习总结
- 20145213《Java程序设计学习笔记》第六周学习总结
- 自动筛选相关用法
- C++继承 总结
- [Java][Maven]Maven部署Web项目报错webxml attribute is required
- 抽象类与接口、异常相关测试与总结
- [实时渲染] 2.5 回顾渲染管线
- hexo搭建静态博客
- Core Graphics
- 千里之行,始于足下的博客园《Linux内核设计与实现》读书笔记
- spring RestTemplate用法详解