답안 #56936

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
56936 2018-07-13T08:57:26 Z 조민규(#2114) 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
370 ms 13132 KB
#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

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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 5 ms 524 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Correct 4 ms 656 KB Output is correct
7 Correct 5 ms 672 KB Output is correct
8 Correct 5 ms 700 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 5 ms 492 KB Output is correct
3 Correct 3 ms 492 KB Output is correct
4 Correct 5 ms 524 KB Output is correct
5 Correct 5 ms 600 KB Output is correct
6 Correct 4 ms 656 KB Output is correct
7 Correct 5 ms 672 KB Output is correct
8 Correct 5 ms 700 KB Output is correct
9 Correct 359 ms 5408 KB Output is correct
10 Correct 190 ms 5408 KB Output is correct
11 Correct 180 ms 5408 KB Output is correct
12 Correct 370 ms 8832 KB Output is correct
13 Correct 187 ms 13076 KB Output is correct
14 Correct 190 ms 13076 KB Output is correct
15 Correct 164 ms 13076 KB Output is correct
16 Correct 190 ms 13088 KB Output is correct
17 Correct 324 ms 13088 KB Output is correct
18 Correct 159 ms 13088 KB Output is correct
19 Correct 176 ms 13088 KB Output is correct
20 Correct 146 ms 13132 KB Output is correct
21 Correct 183 ms 13132 KB Output is correct
22 Correct 180 ms 13132 KB Output is correct
23 Correct 188 ms 13132 KB Output is correct
24 Correct 237 ms 13132 KB Output is correct
25 Correct 309 ms 13132 KB Output is correct
26 Correct 362 ms 13132 KB Output is correct