Submission #677970

# Submission time Handle Problem Language Result Execution time Memory
677970 2023-01-04T19:00:43 Z TAMREF 복사 붙여넣기 2 (JOI15_copypaste2) C++17
100 / 100
147 ms 8580 KB
#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 time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 396 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 106 ms 8404 KB Output is correct
10 Correct 84 ms 8512 KB Output is correct
11 Correct 76 ms 8504 KB Output is correct
12 Correct 98 ms 8452 KB Output is correct
13 Correct 75 ms 8376 KB Output is correct
14 Correct 72 ms 8376 KB Output is correct
15 Correct 76 ms 8580 KB Output is correct
16 Correct 70 ms 8408 KB Output is correct
17 Correct 147 ms 8260 KB Output is correct
18 Correct 57 ms 8404 KB Output is correct
19 Correct 61 ms 8412 KB Output is correct
20 Correct 63 ms 8416 KB Output is correct
21 Correct 59 ms 8404 KB Output is correct
22 Correct 66 ms 8508 KB Output is correct
23 Correct 66 ms 8388 KB Output is correct
24 Correct 72 ms 8444 KB Output is correct
25 Correct 83 ms 8380 KB Output is correct
26 Correct 92 ms 8436 KB Output is correct