Submission #105710

# Submission time Handle Problem Language Result Execution time Memory
105710 2019-04-14T04:19:01 Z Pro_ktmr 복사 붙여넣기 2 (JOI15_copypaste2) C++14
100 / 100
374 ms 8720 KB
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define MP(a,b) make_pair(a,b)
int K,M,N;
string S;
int moto[200];
int L[200000],R[200000],P[200000]; //0-index [l,r) p no mae
int main(){
	cin >> K >> M >> S >> N;
	for(int i=0; i<K; i++) moto[i] = i;
	for(int i=0; i<N; i++){
		cin >> L[i] >> R[i] >> P[i];
	}
	
	for(int i=N-1; i>=0; i--){
		//kopipe saki
		int l = P[i];
		int m = R[i]-L[i];
		int r = P[i]+m; //[l,r)
		for(int j=0; j<K; j++){
			//cout << moto[j] << " ";
			if(l <= moto[j] && moto[j] < r){
				moto[j] = L[i]+(moto[j]-l);
			}
			else if(P[i] < moto[j]) moto[j] -= m;
		}
		//cout << endl;
	}
	
	for(int i=0; i<K; i++) cout << S[moto[i]];
	cout << endl;
	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 6 ms 512 KB Output is correct
9 Correct 359 ms 8472 KB Output is correct
10 Correct 365 ms 8596 KB Output is correct
11 Correct 320 ms 8576 KB Output is correct
12 Correct 319 ms 8700 KB Output is correct
13 Correct 303 ms 8456 KB Output is correct
14 Correct 318 ms 8456 KB Output is correct
15 Correct 277 ms 8452 KB Output is correct
16 Correct 302 ms 8456 KB Output is correct
17 Correct 348 ms 8184 KB Output is correct
18 Correct 348 ms 8720 KB Output is correct
19 Correct 303 ms 8500 KB Output is correct
20 Correct 308 ms 8540 KB Output is correct
21 Correct 301 ms 8568 KB Output is correct
22 Correct 328 ms 8484 KB Output is correct
23 Correct 374 ms 8540 KB Output is correct
24 Correct 305 ms 8544 KB Output is correct
25 Correct 308 ms 8564 KB Output is correct
26 Correct 334 ms 8604 KB Output is correct