比赛 2024暑假C班集训E 评测结果 AAAATTTTTT
题目名称 Swapity Swapity Swap 最终得分 40
用户昵称 ht骨架 运行时间 12.400 s
代码语言 C++ 内存使用 3.43 MiB
提交时间 2024-07-14 10:48:49
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;
int n, a[100005], m, k, l[105], r[105], b;
int main () {
    freopen ("usaco_Feb_swap.in", "r", stdin);
    freopen ("usaco_Feb_swap.out", "w", stdout);
    ios::sync_with_stdio(false);
    cin >> n >> m >> k;
    for (int i = 1; i <= n; i++) {
        a[i] = i;     
    }
    for (int i = 1; i <= m; i++) {
        cin >> l[i] >> r[i];
    }
    for (int i = 1; i <= k; i++) {
        for (int j = 1; j <= m; j++) {
            reverse(a + l[j], a + r[j] + 1);
        }
    }
    for (int i = 1; i <= n; i++) cout << a[i] << endl;
    return 0;
}