답안 #211843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
211843 2020-03-21T14:05:37 Z zimpha 복사 붙여넣기 2 (JOI15_copypaste2) C++17
100 / 100
274 ms 8612 KB
#include <cstdio>
#include <cstring>
#include <cassert>
#include <vector>
#include <string>
#include <algorithm>

const int N = 2e5 + 10;

char s[N];

int main() {
  int n, k, m;
  scanf("%d%d%s", &k, &m, s);
  scanf("%d", &n);
  std::vector<int> a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d%d", &a[i], &b[i], &c[i]);
  }
  for (int i = 0; i < k; ++i) {
    int p = i;
    for (int j = n - 1; j >= 0; --j) {
      int x = c[j], y = x + b[j] - a[j];
      if (p >= y) p -= b[j] - a[j];
      else if (p >= x) p = a[j] + p - x;
    }
    putchar(s[p]);
  }
  puts("");
  return 0;
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d%s", &k, &m, s);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &n);
   ~~~~~^~~~~~~~~~
copypaste2.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &a[i], &b[i], &c[i]);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 6 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 6 ms 384 KB Output is correct
9 Correct 186 ms 8512 KB Output is correct
10 Correct 168 ms 8568 KB Output is correct
11 Correct 163 ms 8440 KB Output is correct
12 Correct 203 ms 8572 KB Output is correct
13 Correct 160 ms 8376 KB Output is correct
14 Correct 152 ms 8312 KB Output is correct
15 Correct 154 ms 8312 KB Output is correct
16 Correct 153 ms 8312 KB Output is correct
17 Correct 274 ms 8328 KB Output is correct
18 Correct 111 ms 8440 KB Output is correct
19 Correct 106 ms 8440 KB Output is correct
20 Correct 107 ms 8440 KB Output is correct
21 Correct 117 ms 8512 KB Output is correct
22 Correct 122 ms 8496 KB Output is correct
23 Correct 139 ms 8440 KB Output is correct
24 Correct 134 ms 8440 KB Output is correct
25 Correct 173 ms 8612 KB Output is correct
26 Correct 192 ms 8440 KB Output is correct