Submission #747195

#TimeUsernameProblemLanguageResultExecution timeMemory
747195MilosMilutinovic복사 붙여넣기 2 (JOI15_copypaste2)C++14
100 / 100
218 ms8576 KiB
#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 (stderr)

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]++;
      |                                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...