Submission #677468

#TimeUsernameProblemLanguageResultExecution timeMemory
67746879brue복사 붙여넣기 2 (JOI15_copypaste2)C++17
100 / 100
145 ms3340 KiB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, k;
char arr[200002];
int a[200002], b[200002], c[200002];
int loc[200002];

int main(){
    scanf("%d %d", &k, &n);
    scanf("%s", arr+1);
    scanf("%d", &n);
    for(int i=1; i<=n; i++) scanf("%d %d %d", &a[i], &b[i], &c[i]);
    for(int i=1; i<=k; i++){
        loc[i] = i;
    }
    for(int i=n; i>=1; i--){
        for(int j=1; j<=k; j++){
            if(loc[j] <= c[i]) {}
            else if(loc[j] <= c[i] + (b[i] - a[i])) loc[j] -= c[i] - a[i];
            else loc[j] -= (b[i] - a[i]);
        }
    }
    for(int i=1; i<=k; i++){
        printf("%c", arr[loc[i]]);
    }
}

Compilation message (stderr)

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d %d", &k, &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~
copypaste2.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |     scanf("%s", arr+1);
      |     ~~~~~^~~~~~~~~~~~~
copypaste2.cpp:15:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
copypaste2.cpp:16:34: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |     for(int i=1; i<=n; i++) scanf("%d %d %d", &a[i], &b[i], &c[i]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...