# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
958791 | gmroh06 | 복사 붙여넣기 2 (JOI15_copypaste2) | C++14 | 185 ms | 11024 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#import <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
inline void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
int main() {
fastio();
ll k, m, n;
string s, ans;
cin >> k >> m >> s >> n;
vector<ll> a(n), b(n), c(n);
for (ll i = 0; i < n; i++) {
cin >> a[i] >> b[i] >> c[i];
}
for (ll i = 0; i < k; i++) {
ll idx = i;
for (ll j = n - 1; j >= 0; j--) {
if (idx < c[j]) continue;
if (idx < b[j] + c[j] - a[j]) {
idx += a[j] - c[j];
} else {
idx += a[j] - b[j];
}
}
ans += s[idx];
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |