编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22501 #1018. 1-01E. JM的俄罗斯套娃 Accepted 100 35 ms 996 K C++ / 1.4 K 机类910-尚锦奥 2020-02-12 23:13:24
显示原始代码
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <queue>
#include <vector>
#include <stack>
#include <set>
#include <cmath>
#include <bitset>
#define lson node << 1
#define rson node << 1 | 1
using namespace std;
#define ll long long
const ll maxn = 5e5 + 10;
ll read() {
    char c = getchar();
    ll x = 0;
    ll flag = 1;
    while (c < '0' || c > '9') {
        if (c == '-')
            flag = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - 48;
        c = getchar();
    }
    x *= flag;
    return x;
}
vector<int> a[50005];
int n;
int cur = 1;
int c = -1;
vector<int>::iterator it;
int ls[50005];
int main() {
    n = read();
    for (int i = 1; i <= n; i++) {
        int opt = read();
        if (opt == 1) {
            int p = read(), v = read();
            it = a[cur].begin();
            for (int j = 1; j <= p; j++) it++;
            if (v == 0)
                c--;
            a[cur].insert(it, v == 0 ? c : v);
            if (v == 0)
                ls[-c] = cur;
        } else if (opt == 2) {
            int p = read();
            it = a[cur].begin();
            for (int j = 1; j <= p - 1; j++) it++;
            a[cur].erase(it);
        } else if (opt == 3) {
            int p = read();
            if (p == 0) {
                if (ls[cur])
                    cur = ls[cur];
            } else {
                it = a[cur].begin();
                for (int j = 1; j <= p - 1; j++) it++;
                if (*it < 0)
                    cur = -*it;
            }
        } else {
            it = a[cur].begin();
            printf("{");
            while (it != a[cur].end()) {
                *it > 0 ? printf("%d", *it) : printf("[]");
                if (it + 1 != a[cur].end())
                    printf(" ");
                it++;
            }
            puts("}");
        }
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:928 KiB

输入文件(1.in

12
1 0 1
1 0 2
1 1 0
4
2 3
4
3 2
4
1 0 6
4
3 0
4

答案文件(1.out

{2 [] 1}
{2 []}
{}
{6}
{2 []}

用户输出

{2 [] 1}
{2 []}
{}
{6}
{2 []}

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:4 ms
内存:864 KiB

输入文件(2.in

10
1 0 1
1 0 2
1 1 3
1 1 4
1 3 5
1 5 6
4
2 2
2 4
4

答案文件(2.out

{2 4 3 5 1 6}
{2 3 5 6}

用户输出

{2 4 3 5 1 6}
{2 3 5 6}

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:5 ms
内存:864 KiB

输入文件(3.in

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>

答案文件(3.out

{[] 7 [] 4}
{[] 89 [] []}
{[] 7 [] 4}
{}
{1}
{}
{[] 7 [] 4}
{[] [] 4}

用户输出

{[] 7 [] 4}
{[] 89 [] []}
{[] 7 [] 4}
{}
{1}
{}
{[] 7 [] 4}
{[] [] 4}

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:3 ms
内存:996 KiB

输入文件(4.in

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>

答案文件(4.out

{[] [] 1 2}
{23 12 19 []}
{[] 1 2}
{}

用户输出

{[] [] 1 2}
{23 12 19 []}
{[] 1 2}
{}

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:4 ms
内存:860 KiB

输入文件(5.in

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>

答案文件(5.out

{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
测试点 #6
Accepted
得分:100
用时:3 ms
内存:912 KiB

输入文件(6.in

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>

答案文件(6.out

{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
测试点 #7
Accepted
得分:100
用时:3 ms
内存:868 KiB

输入文件(7.in

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>

答案文件(7.out

{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
测试点 #8
Accepted
得分:100
用时:4 ms
内存:928 KiB

输入文件(8.in

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.out

{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
Accepted
得分:100
用时:3 ms
内存:924 KiB

输入文件(9.in

12
3 0
1 0 0
3 1
1 0 9
3 1
4
3 0
4
2 1
1 0 0
3 1
4

答案文件(9.out

{9}
{[]}
{}

用户输出

{9}
{[]}
{}

系统信息

Exited with return code 0
测试点 #10
Accepted
得分:100
用时:3 ms
内存:864 KiB

输入文件(10.in

32
1 0 46
3 1
1 1 0
4
2 1
3 1
4
1 0 0
3 1
4
1 0 0
3 1
1 0 0
3 1
1 0 12
1 0 14
1 2 2
<73 bytes omitted>

答案文件(10.out

{46 []}
{}
{}
{14 24}
{94}
{[]}
{7}

用户输出

{46 []}
{}
{}
{14 24}
{94}
{[]}
{7}

系统信息

Exited with return code 0