Submission #211843

#TimeUsernameProblemLanguageResultExecution timeMemory
211843zimpha복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
274 ms8612 KiB
#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 (stderr)

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