Submission #105710

#TimeUsernameProblemLanguageResultExecution timeMemory
105710Pro_ktmr복사 붙여넣기 2 (JOI15_copypaste2)C++14
100 / 100
374 ms8720 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...