제출 #677379

#제출 시각아이디문제언어결과실행 시간메모리
677379jhwest2복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
243 ms3124 KiB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int N = 202020;
int n, m, k, q, a[N], b[N], c[N]; string s;
int main() {
    cin.tie(0); ios_base::sync_with_stdio(0);
    cin >> k >> m >> s >> q;
    n = s.size();

    for (int i = 1; i <= q; i++) {
        cin >> a[i] >> b[i] >> c[i];
    }
    for (int i = 1; i <= k; i++) {
        ll p = i;
        for (int j = q; j >= 1; j--) {
            if (c[j] + 1 <= p && p <= c[j] + b[j] - a[j])
                p = a[j] + (p - c[j]);
            else if (p > c[j] + b[j] - a[j])
                p -= (b[j] - a[j]);
        }
        cout << s[p - 1];
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...