제출 #198995

#제출 시각아이디문제언어결과실행 시간메모리
198995mhy908복사 붙여넣기 2 (JOI15_copypaste2)C++14
100 / 100
292 ms2936 KiB
#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));
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...