Submission #57145

#TimeUsernameProblemLanguageResultExecution timeMemory
57145gs13105복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
309 ms75020 KiB
#include <cstdio> #include <cstdlib> #include <cstring> #include <cassert> #include <iostream> #include <algorithm> #include <string> #include <vector> #include <list> #include <stack> #include <queue> #include <deque> #include <set> #include <map> #include <tuple> #include <iterator> using namespace std; char arr[200010]; int a[200010]; int b[200010]; int c[200010]; int main() { //freopen("in", "r", stdin); //freopen("out", "w", stdout); int k, m, n, i, j; scanf("%d%d%s%d", &k, &m, arr + 1, &n); for(i = 0; i < n; i++) scanf("%d%d%d", &a[i], &b[i], &c[i]); for(i = 1; i <= k; i++) { int x = i; for(j = n - 1; j >= 0; j--) { if(x >= c[j] + 1) { if(x > c[j] + b[j] - a[j]) x -= b[j] - a[j]; else x = a[j] + x - c[j]; } } printf("%c", arr[x]); } return 0; }

Compilation message (stderr)

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%s%d", &k, &m, arr + 1, &n);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp:33:14: 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...