Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _USE_MATH_DEFINES
- #include <iostream>
- #include <conio.h>
- #include <string>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <string>
- #include <math.h>
- #include <vector>
- #include <cmath>
- using namespace std;
- int main()
- {
- long long min = 10, n, prom;
- set <int> is, hun;
- bool d=true;
- string prom2;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> prom >> prom2;
- if (prom2 == "hungry")
- {
- bool what = true;
- for (auto i = is.begin(); i != is.end(); i++)
- {
- if (prom >= *i)
- what = false;
- }
- if (what == true)
- hun.insert(prom);
- else
- {
- d = false;
- }
- }
- else
- {
- bool what = true;
- for (auto i = hun.begin(); i != hun.end(); i++)
- {
- if (prom <= *i)
- what = false;
- }
- if (min > prom)
- min = prom;
- if (what == true)
- is.insert(prom);
- else
- {
- d = false;
- }
- }
- }
- if (d == true)
- if (min <= 2)
- cout << "Inconsistent";
- else
- cout << min;
- else
- cout << "Inconsistent";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment