用户输出
{2 [] 1}
{2 []}
{}
{6}
{2 []}
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#20778 | #1018. 1-01E. JM的俄罗斯套娃 | Accepted | 100 | 40 ms | 356 K | C++ / 1.1 K | RBQRBQ | 2019-08-02 15:11:58 |
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
vector<pii> a[110];
int n, cnt, temp, k, x, y;
int main() {
cin >> n;
a[0].push_back(make_pair(-1, 0));
for (int i = 0; i < n; i++) {
cin >> cnt;
if (cnt == 1) {
cin >> x >> y;
if (y == 0) {
a[k].insert(a[k].begin() + x + 1, make_pair(0, ++temp));
a[temp].push_back(make_pair(-1, k));
} else {
a[k].insert(a[k].begin() + x + 1, make_pair(1, y));
}
continue;
}
if (cnt == 2) {
cin >> x;
a[k].erase(a[k].begin() + x);
continue;
}
if (cnt == 3) {
cin >> x;
if (x == 0)
k = (a[k][0]).second;
else {
if (a[k][x].first == 0)
k = a[k][x].second;
}
continue;
}
if (cnt == 4) {
if (a[k].size() == 1)
cout << "{}" << endl;
else {
cout << "{";
for (int pop = 1; pop < a[k].size() - 1; pop++) {
if (a[k][pop].first == 0)
cout << "[] ";
else
cout << a[k][pop].second << " ";
}
if (a[k][a[k].size() - 1].first == 0)
puts("[]}");
else
cout << a[k][a[k].size() - 1].second << "}" << endl;
continue;
}
}
}
return 0;
}
用户输出
{2 [] 1}
{2 []}
{}
{6}
{2 []}
系统信息
Exited with return code 0
用户输出
{2 4 3 5 1 6}
{2 3 5 6}
系统信息
Exited with return code 0
28
1 0 12
1 1 4
1 1 7
1 2 0
1 0 0
2 2
4
3 1
1 0 89
1 1 0
1 0 0
1 3 0
4
3 0
4
3 3
4
<50 bytes omitted>
用户输出
{[] 7 [] 4}
{[] 89 [] []}
{[] 7 [] 4}
{}
{1}
{}
{[] 7 [] 4}
{[] [] 4}
系统信息
Exited with return code 0
20
1 0 0
1 1 1
1 0 0
1 3 2
4
3 1
1 0 17
1 1 12
1 2 19
2 1
1 0 23
1 3 0
4
3 0
3 1
3 0
<16 bytes omitted>
用户输出
{[] [] 1 2}
{23 12 19 []}
{[] 1 2}
{}
系统信息
Exited with return code 0
45
1 0 11
1 1 0
2 1
1 0 32
4
3 2
1 0 0
1 1 0
1 2 40
1 3 0
4
3 3
4
3 2
1 0 0
3 1
1 0
<129 bytes omitted>
{32 []}
{[] [] 40 []}
{[] [] 40 []}
{12}
{[]}
{12}
{[] [] 40 []}
{32 []}
{32 []}
{[] [] 40
<26 bytes omitted>
用户输出
{32 []}
{[] [] 40 []}
{[] [] 40 []}
{12}
{[]}
{12}
{[] [] 40 []}
{32 []}
{32 []}
{[] [] 40 []}
{[] 40 []}
{32 []}
系统信息
Exited with return code 0
50
1 0 12
1 0 8
1 0 19
1 3 6
4
1 4 34
1 5 7
1 5 8
4
1 7 91
1 1 1
1 7 2
1 0 12
4
1 0 8
<251 bytes omitted>
{19 8 12 6}
{19 8 12 6 34 8 7}
{12 19 1 8 12 6 34 8 2 7 91}
{19 8 12 6 34 7 19 1 8 12 6 34 8 2 7
<259 bytes omitted>
用户输出
{19 8 12 6}
{19 8 12 6 34 8 7}
{12 19 1 8 12 6 34 8 2 7 91}
{19 8 12 6 34 7 19 1 8 12 6 34 8 2 7 91}
{19 8 12 6 34 8 7 19 1 8 12
<224 bytes omitted>
系统信息
Exited with return code 0
50
1 0 0
1 0 8
2 2
1 1 6
4
1 2 34
1 3 0
1 3 8
4
1 4 0
2 1
1 4 2
1 0 12
4
1 0 8
1 0 1
<234 bytes omitted>
{8 6}
{8 6 34 8 []}
{12 6 34 8 [] 2 []}
{19 8 12 6 34 7 6 34 8 [] 2 []}
{12 19 [] 6 74 83 [] 8 1
<186 bytes omitted>
用户输出
{8 6}
{8 6 34 8 []}
{12 6 34 8 [] 2 []}
{19 8 12 6 34 7 6 34 8 [] 2 []}
{12 19 [] 6 74 83 [] 8 12 6 34 8 2 7 6 95 34 8 [] 2 []}
<151 bytes omitted>
系统信息
Exited with return code 0
50
1 0 0
1 1 0
1 0 29
1 3 0
1 0 8
1 5 0
1 1 88
1 2 0
2 8
4
3 5
1 0 63
1 0 52
1 2 19
1
<187 bytes omitted>
{8 88 [] 29 [] [] []}
{63 7}
{8 88 [] 29 [] [] []}
{18 71 33}
{18}
{5 15 45}
{9 15 45}
{9 15
<16 bytes omitted>
用户输出
{8 88 [] 29 [] [] []}
{63 7}
{8 88 [] 29 [] [] []}
{18 71 33}
{18}
{5 15 45}
{9 15 45}
{9 15 45}
{9 15 45}
系统信息
Exited with return code 0
用户输出
{9}
{[]}
{}
系统信息
Exited with return code 0