| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1351071 | lnt314 | 복사 붙여넣기 2 (JOI15_copypaste2) | C++20 | 16 ms | 1716 KiB |
// Frozen Forest (")>
#include <bits/stdc++.h>
#define NAME ""
#define ll long long
#define fi first
#define se second
#define vec vector
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) ((int)x.size())
using namespace std;
const int N=1e5+5;
int k,m;
string s;
int n;
struct Act{int a,b,c;} acts[N];
void INIT(){
cin>>k>>m>>s>>n;
for(int i=1;i<=n;i++){
int a,b,c;
cin>>a>>b>>c;
acts[i]={a,b,c};
}
}
namespace SUB1{
bool CHKSUB(){return n<=2000&&m<=2000;}
void SOLVE(){
for(int ai=1;ai<=n;ai++){
int a=acts[ai].a,b=acts[ai].b,c=acts[ai].c;
string t=s.substr(a,b-a);
string as;
for(;SZ(s)>c;s.pop_back()) as+=s.back();
reverse(ALL(as));
// cerr<<s<<' '<<t<<' '<<as<<'\n';
s+=t;
s+=as;
while(SZ(s)>m) s.pop_back();
// cerr<<s<<'\n';
// cerr<<'\n';
}
cout<<s.substr(0,k);
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
if(fopen(NAME ".inp","r")){
freopen(NAME ".inp","r",stdin);
freopen(NAME ".out","w",stdout);
}
INIT();
if(SUB1::CHKSUB()||1) return SUB1::SOLVE(),0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
