Submission #198995

# Submission time Handle Problem Language Result Execution time Memory
198995 2020-01-28T14:44:43 Z mhy908 복사 붙여넣기 2 (JOI15_copypaste2) C++14
100 / 100
292 ms 2936 KB
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
typedef pair<int, int> pii;
int n, m, k;
char str[200010];
pair<pii, int> query[200010];
char get_c(int num){
    for(int i=n; i>=1; i--){
        if(num<=query[i].S)continue;
        else if(num>query[i].S+query[i].F.S-query[i].F.F)num-=query[i].F.S-query[i].F.F;
        else num+=query[i].F.F-query[i].S;
    }
    return str[num];
}
int main(){
    scanf("%d %d", &k, &m);
    scanf("%s", str+1);
    scanf("%d", &n);
    for(int i=1; i<=n; i++)scanf("%d %d %d", &query[i].F.F, &query[i].F.S, &query[i].S);
    for(int i=1; i<=k; i++)printf("%c", get_c(i));
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d %d", &k, &m);
     ~~~~~^~~~~~~~~~~~~~~~~
copypaste2.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s", str+1);
     ~~~~~^~~~~~~~~~~~~
copypaste2.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
copypaste2.cpp:21:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=1; i<=n; i++)scanf("%d %d %d", &query[i].F.F, &query[i].F.S, &query[i].S);
                            ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 276 ms 2796 KB Output is correct
10 Correct 130 ms 2680 KB Output is correct
11 Correct 131 ms 2680 KB Output is correct
12 Correct 292 ms 2808 KB Output is correct
13 Correct 126 ms 2936 KB Output is correct
14 Correct 121 ms 2936 KB Output is correct
15 Correct 129 ms 2936 KB Output is correct
16 Correct 124 ms 2936 KB Output is correct
17 Correct 253 ms 2680 KB Output is correct
18 Correct 126 ms 2684 KB Output is correct
19 Correct 115 ms 2680 KB Output is correct
20 Correct 116 ms 2680 KB Output is correct
21 Correct 124 ms 2680 KB Output is correct
22 Correct 136 ms 2808 KB Output is correct
23 Correct 156 ms 2680 KB Output is correct
24 Correct 170 ms 2736 KB Output is correct
25 Correct 229 ms 2680 KB Output is correct
26 Correct 280 ms 2808 KB Output is correct