Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long LL;
- const int maxn = 100 + 100;
- int n, x;
- string cmd;
- int cnt[maxn];
- int main() {
- #ifdef ExRoc
- freopen("test.txt", "r", stdin);
- #endif // ExRoc
- ios::sync_with_stdio(false);
- cin >> n;
- while (cin >> cmd) {
- if (cmd[0] == 'a') {
- cin >> x;
- ++cnt[0];
- }
- if (cmd[0] == 's') {
- cin >> x;
- cnt[x] = min(cnt[x] + 1, cnt[0]);
- }
- if (cmd[0] == 'q') {
- int ans = cnt[0];
- for (int i = 0; i < n; ++i) {
- ans = min(ans, cnt[i]);
- }
- cout << ans << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement