cf 357C
2013-10-19 11:27
176 查看
比赛的时候纯暴力超时了 看了别人的代码 set容器类做的 stl里还是有很多好东西的
/************************************************************************* > Author: xlc2845 > Mail: xlc2845@gmail.com > Created Time: 2013年10月19日 星期六 10时20分33秒 ************************************************************************/ #include <iostream> #include <algorithm> #include <string> #include <cstring> #include <cmath> #include <set> #include <vector> #include <cstdio> using namespace std; set<int> t; set<int>::iterator it1, it2, it; int w[300010]; int main ( ) { int n,m,le,re,x; scanf("%d%d",&n,&m) ; for(int i = 1; i <= n; i++) t.insert(i); while(m--) { scanf("%d%d%d", &le, &re, &x); it1 = t.lower_bound(le); it2 = t.lower_bound(re + 1); for (it = it1 ; it != it2; it++) w[*it] = x; t.erase(it1, it2); t.insert(x); } w[x] = 0; for(int i = 1; i <= n; i++) printf( "%d ", w[i]); puts(""); return 0; }
相关文章推荐
- cf 357C
- CF 547 C Mike and Foam(容斥原理)
- cf 547C 容斥原理
- [CF 306E]Levko and Game题解翻译
- CF 6B President's Office
- cf 474E 线段树+dp+离散化后二分查找
- Mike and Feet(CF 547B)
- CF 557C(Arthur and Table-直接暴力)
- CF 3C Tic-tac-toe
- dp cf C. Mr. Kitayuta, the Treasure Hunter
- CF-242-C bfs+stl
- CF 559 B Equivalent Strings(字符串匹配)
- CF 558E(A Simple Task-计数排序+线段树)
- nyoj 1216——整理图书 CF 229D—— Towers——————【dp+贪心】
- 【CF 520D】Cubes
- CF_469C_24Game
- RunLoop学习笔记,从CF层面了解由于CFRunLoopMode机制
- Interesting Integers(CF---BAPC 14 + hnoj11589)扩展欧几里得
- CF 514C hash,字典树
- CF 219 D Choosing Capital for Treeland(树形dp)