Submission #677970

#TimeUsernameProblemLanguageResultExecution timeMemory
677970TAMREF복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
147 ms8580 KiB
#include <bits/stdc++.h> #define va first #define vb second #define lb lower_bound #define ub upper_bound #define bs binary_search #define pp push_back #define ep emplace_back #define all(v) (v).begin(),(v).end() #define szz(v) ((int)(v).size()) #define bi_pc __builtin_popcount #define bi_pcll __builtin_popcountll #define bi_tz __builtin_ctz #define bi_tzll __builtin_ctzll #define fio ios_base::sync_with_stdio(0);cin.tie(0); #ifdef TAMREF #define debug(...) fprintf(stderr, __VA_ARGS__) #else #define debug(...) 42 #endif using namespace std; template<typename ...Args> void logger(string vars, Args&&... values) { cerr << vars << " = "; string delim = ""; (..., (cerr << delim << values, delim = ", ")); cerr << '\n'; } #ifdef TAMREF #define deb(...) logger(#__VA_ARGS__, __VA_ARGS__) #else #define deb(...) 42 #endif using ll = long long; using lf = long double; using pii = pair<int,int>; using ppi = pair<int,pii>; using pll = pair<ll,ll>; using pff = pair<lf,lf>; using ti = tuple<int,int,int>; using base = complex<double>; const lf PI = 3.14159265358979323846264338L; template <typename T> inline T umax(T& u, T v){return u = max(u, v);} template <typename T> inline T umin(T& u, T v){return u = min(u, v);} mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); int n, k, m; int pos[205]; int a[200005], b[200005], c[200005]; string S; int main(){ fio; cin >> k >> m; for(int i = 1; i <= k; i++) pos[i] = i; cin >> S; cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i] >> b[i] >> c[i]; } for(int i = n; i >= 1; i--) { for(int j = 1; j <= k; j++) { if(pos[j] <= c[i]) continue; if(pos[j] <= c[i] + b[i] - a[i]) pos[j] = pos[j] - c[i] + a[i]; else pos[j] -= b[i] - a[i]; } } for(int i = 1; i <= k; i++) cout << S[pos[i] - 1]; cout << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...