Submission #57145

# Submission time Handle Problem Language Result Execution time Memory
57145 2018-07-14T07:02:24 Z gs13105 복사 붙여넣기 2 (JOI15_copypaste2) C++17
100 / 100
309 ms 75020 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]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 5 ms 488 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 3 ms 676 KB Output is correct
6 Correct 3 ms 676 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 3 ms 696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 488 KB Output is correct
3 Correct 5 ms 488 KB Output is correct
4 Correct 3 ms 560 KB Output is correct
5 Correct 3 ms 676 KB Output is correct
6 Correct 3 ms 676 KB Output is correct
7 Correct 2 ms 676 KB Output is correct
8 Correct 3 ms 696 KB Output is correct
9 Correct 284 ms 8788 KB Output is correct
10 Correct 144 ms 14776 KB Output is correct
11 Correct 139 ms 20540 KB Output is correct
12 Correct 296 ms 26360 KB Output is correct
13 Correct 131 ms 31880 KB Output is correct
14 Correct 129 ms 37368 KB Output is correct
15 Correct 126 ms 42788 KB Output is correct
16 Correct 141 ms 48236 KB Output is correct
17 Correct 309 ms 53612 KB Output is correct
18 Correct 137 ms 59340 KB Output is correct
19 Correct 154 ms 65120 KB Output is correct
20 Correct 132 ms 70968 KB Output is correct
21 Correct 123 ms 74900 KB Output is correct
22 Correct 162 ms 74900 KB Output is correct
23 Correct 207 ms 75020 KB Output is correct
24 Correct 175 ms 75020 KB Output is correct
25 Correct 233 ms 75020 KB Output is correct
26 Correct 303 ms 75020 KB Output is correct