Submission #750911

#TimeUsernameProblemLanguageResultExecution timeMemory
750911chocolatte복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
209 ms10900 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pll pair<ll,ll> #define fi first #define se second #define pb push_back #define mp make_pair #define mod 1000000007 #define F(i,a,b) for(ll i=a;i<=b;i++) const ll mxn=2e5+5; ll k,m,n; string s; ll a[mxn],b[mxn],c[mxn]; char solve(ll pos,ll x) { if (x==0) { return s[pos]; } ll len=b[x]-a[x]; if (pos<c[x]) { return solve(pos,x-1); } else if (pos<c[x]+len) { return solve(a[x]+pos-c[x],x-1); } else { return solve(pos-len,x-1); } } int main() { //freopen("nah.inp","r",stdin); ios::sync_with_stdio(false); cin.tie(0); cin>>k>>m; cin>>s; cin>>n; F(i,1,n) { cin>>a[i]>>b[i]>>c[i]; } F(i,0,k-1) { cout<<solve(i,n); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...