模拟 之 Codeforces 416A
2014-04-13 23:56
423 查看
// [4/13/2014 Sjm] /* 关键: 寻找 左右区间,判断此区间是否合理。 */
#include <iostream> #include <cstdio> #include <cstdlib> #include <string> #include <algorithm> using namespace std; const int MAX = 2000000000, MIN = -2000000000; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n, lef = MIN, rig = MAX, temp; string str; char c; scanf("%d", &n); while (n--) { cin >> str; scanf("%d %c", &temp, &c); if ('N' == c) { if (">" == str) str = "<="; else { if ("<" == str) str = ">="; else { if ("<=" == str) str = ">"; else str = "<"; } } } if (">" == str) lef = max(lef, temp + 1); else { if ("<" == str) rig = min(rig, temp - 1); else { if (">=" == str) lef = max(lef, temp); else rig = min(rig, temp); } } } if (lef > rig) printf("Impossible\n"); else printf("%d\n", lef); return 0; }
相关文章推荐
- 模拟 之 Codeforces 416A
- Codeforces 706E Working routine (模拟链表)
- Codeforces 202B Brand New Easy Problem(模拟)
- Codeforces 438D (今日gg模拟第二题) | 线段树 考察时间复杂度的计算 -_-|||
- 【STL】【模拟】Codeforces 696A Lorenzo Von Matterhorn
- CodeForces 471B MUH and Important Things 模拟 水
- 【Goodbye2014】Codeforces 500C New Year Book Reading【贪心+模拟】
- Codeforces Round #378 (Div. 2) C && Codeforces 733C (模拟)详解(两种写法)
- 【并查集】【模拟】Codeforces 698B & 699D Fix a Tree
- 【CodeForces 282B】Painting Eggs(模拟)
- 【模拟】Codeforces 710A King Moves
- CodeForces - 858C【贪心+模拟】
- Codeforces 534D - Handshakes (贪心 + 模拟)
- 【模拟】Codeforces 691C Exponential notation
- CodeForces 518C - Watto and Mechanism(模拟)
- CodeForces 651A:Joysticks【模拟】
- Codeforces 606 B Testing Robots【模拟】
- CodeForces 722B. Verse Pattern(模拟)
- Codeforces 651C Watchmen【模拟】
- Codeforces--400A--Inna and Choose Options(模拟水题)