답안 #747195

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
747195 2023-05-23T21:36:15 Z MilosMilutinovic 복사 붙여넣기 2 (JOI15_copypaste2) C++14
100 / 100
218 ms 8576 KB
#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int k, m, n, q, l[N], r[N], c[N];
char s[N];
int main() {
    scanf("%d%d", &k, &m);
    scanf("%s", s + 1);
    n = strlen(s + 1);
    scanf("%d", &q);
    for (int i = 1; i <= q; i++) scanf("%d%d%d", &l[i], &r[i], &c[i]), l[i]++;
    for (int i = 1; i <= k; i++) {
        int x = i;
        for (int j = q; j >= 1; j--) {
            int len = r[j] - l[j] + 1;
            if (x <= c[j]) continue;
            if (x > c[j] + len) x -= len;
            else x = l[j] + (x - c[j] - 1);
        }
        printf("%c", s[x]);
    }
    return 0;
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d%d", &k, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
copypaste2.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%s", s + 1);
      |     ~~~~~^~~~~~~~~~~~~
copypaste2.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
copypaste2.cpp:11:39: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 1; i <= q; i++) scanf("%d%d%d", &l[i], &r[i], &c[i]), l[i]++;
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 320 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 196 ms 8444 KB Output is correct
10 Correct 82 ms 8404 KB Output is correct
11 Correct 87 ms 8408 KB Output is correct
12 Correct 218 ms 8576 KB Output is correct
13 Correct 80 ms 8392 KB Output is correct
14 Correct 79 ms 8220 KB Output is correct
15 Correct 82 ms 8292 KB Output is correct
16 Correct 88 ms 8204 KB Output is correct
17 Correct 191 ms 8180 KB Output is correct
18 Correct 65 ms 8356 KB Output is correct
19 Correct 65 ms 8328 KB Output is correct
20 Correct 66 ms 8320 KB Output is correct
21 Correct 70 ms 8436 KB Output is correct
22 Correct 81 ms 8432 KB Output is correct
23 Correct 134 ms 8432 KB Output is correct
24 Correct 119 ms 8428 KB Output is correct
25 Correct 161 ms 8428 KB Output is correct
26 Correct 206 ms 8500 KB Output is correct