1234567891011121314151617181920212223242526 |
- //
- // Created by liuhuan on 18-10-29.
- //
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n, q;
- cin >> n >> q;
- vector<stack<int>> S(n);
- while (q--) {
- int op, t;
- cin >> op >> t;
- if (op == 0) {
- int x;
- cin >> x;
- S[t].push(x);
- } else if (op == 1) {
- if (S[t].size()) cout << S[t].top() << endl;
- } else if (op == 2) {
- if (S[t].size()!=0) S[t].pop();
- }
- }
- return 0;
- }
|