답안 #56882

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
56882 2018-07-13T04:57:06 Z 강태규(#1633) 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
248 ms 3200 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>

using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;

int k, m, n;
int pos[200];
char str[200001];
struct query {
    int a, b, c;
    void scan() {
        scanf("%d%d%d", &a, &b, &c);
    }
} qs[200000];
int main() {
    scanf("%d%d%s%d", &k, &m, str, &n);
    for (int i = 0; i < k; ++i) pos[i] = i;
    for (int i = 0; i < n; ++i) {
        qs[i].scan();
    }
    for (int i = n; i--; ) {
        int a = qs[i].a, b = qs[i].b, c = qs[i].c;
        for (int j = 0; j < k; ++j) {
            if (pos[j] < c) {
                
            }
            else if (pos[j] < c + b - a) {
                pos[j] += a - c;
            }
            else {
                pos[j] -= b - a;
            }
        }
    }
    for (int i = 0; i < k; ++i) {
        printf("%c", str[pos[i]]);
    }
    printf("\n");
	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, str, &n);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp: In member function 'void query::scan()':
copypaste2.cpp:27:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d", &a, &b, &c);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 4 ms 520 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 3 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Correct 3 ms 520 KB Output is correct
6 Correct 4 ms 520 KB Output is correct
7 Correct 2 ms 592 KB Output is correct
8 Correct 3 ms 720 KB Output is correct
9 Correct 170 ms 2988 KB Output is correct
10 Correct 155 ms 2988 KB Output is correct
11 Correct 151 ms 2988 KB Output is correct
12 Correct 167 ms 2988 KB Output is correct
13 Correct 146 ms 3088 KB Output is correct
14 Correct 161 ms 3200 KB Output is correct
15 Correct 177 ms 3200 KB Output is correct
16 Correct 141 ms 3200 KB Output is correct
17 Correct 248 ms 3200 KB Output is correct
18 Correct 143 ms 3200 KB Output is correct
19 Correct 117 ms 3200 KB Output is correct
20 Correct 110 ms 3200 KB Output is correct
21 Correct 118 ms 3200 KB Output is correct
22 Correct 145 ms 3200 KB Output is correct
23 Correct 141 ms 3200 KB Output is correct
24 Correct 127 ms 3200 KB Output is correct
25 Correct 191 ms 3200 KB Output is correct
26 Correct 222 ms 3200 KB Output is correct