답안 #677468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
677468 2023-01-03T11:57:48 Z 79brue 복사 붙여넣기 2 (JOI15_copypaste2) C++17
100 / 100
145 ms 3340 KB
#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

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]);
      |                             ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 316 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 2 ms 316 KB Output is correct
6 Correct 2 ms 320 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 2 ms 340 KB Output is correct
9 Correct 111 ms 3028 KB Output is correct
10 Correct 96 ms 3008 KB Output is correct
11 Correct 131 ms 3036 KB Output is correct
12 Correct 107 ms 2972 KB Output is correct
13 Correct 91 ms 3228 KB Output is correct
14 Correct 91 ms 3192 KB Output is correct
15 Correct 120 ms 3340 KB Output is correct
16 Correct 91 ms 3208 KB Output is correct
17 Correct 145 ms 2928 KB Output is correct
18 Correct 65 ms 2952 KB Output is correct
19 Correct 64 ms 3000 KB Output is correct
20 Correct 62 ms 2912 KB Output is correct
21 Correct 69 ms 2960 KB Output is correct
22 Correct 85 ms 2992 KB Output is correct
23 Correct 81 ms 3140 KB Output is correct
24 Correct 78 ms 2944 KB Output is correct
25 Correct 108 ms 2944 KB Output is correct
26 Correct 108 ms 2972 KB Output is correct