제출 #110119

#제출 시각아이디문제언어결과실행 시간메모리
110119njchung99복사 붙여넣기 2 (JOI15_copypaste2)C++14
100 / 100
291 ms8652 KiB
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int l[200010], r[200010], p[200010];
string a;
int dap[200010];
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m, k;
	cin >> n >> m >> a >> k;
	for (int i = 0; i < k; i++)
		cin >> l[i] >> r[i] >> p[i];
	for (int i = 0; i < n; i++) {
		int pos = i;
		for (int y = k - 1; y >= 0; y--) {
			int len = r[y] - l[y];
			if (pos >= p[y] + len)
				pos -= len;
			else if (pos >= p[y]) {
				pos = pos - p[y] + l[y];
			}
		}
		cout << a[pos];
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...