Submission #56883

# Submission time Handle Problem Language Result Execution time Memory
56883 2018-07-13T05:00:01 Z koosaga(#1631) 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
348 ms 3180 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <string>
#include <functional>
#include <vector>
#include <numeric>
#include <deque>
#include <bitset>
#include <iostream>
using namespace std;
using pi = pair<int, int>;
const int MAXN = 200005;

char str[MAXN];
int s[MAXN], e[MAXN], x[MAXN];

int main(){
	int n, m, q;
	cin >> n >> m >> str >> q;
	for(int i=0; i<q; i++) scanf("%d %d %d",&s[i],&e[i],&x[i]);
	for(int i=0; i<n; i++){
		int pos = i;
		for(int j=q-1; j>=0; j--){
			int L = e[j] - s[j];
			if(pos >= x[j] + L){
				pos -= L;
			}
			else if(pos >= x[j]){
				pos = (pos - x[j]) + s[j];
			}
		}
		putchar(str[pos]);
	}
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:28:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=0; i<q; i++) scanf("%d %d %d",&s[i],&e[i],&x[i]);
                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 5 ms 564 KB Output is correct
4 Correct 5 ms 564 KB Output is correct
5 Correct 4 ms 564 KB Output is correct
6 Correct 4 ms 564 KB Output is correct
7 Correct 5 ms 580 KB Output is correct
8 Correct 4 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 5 ms 484 KB Output is correct
3 Correct 5 ms 564 KB Output is correct
4 Correct 5 ms 564 KB Output is correct
5 Correct 4 ms 564 KB Output is correct
6 Correct 4 ms 564 KB Output is correct
7 Correct 5 ms 580 KB Output is correct
8 Correct 4 ms 612 KB Output is correct
9 Correct 348 ms 2988 KB Output is correct
10 Correct 181 ms 3048 KB Output is correct
11 Correct 204 ms 3048 KB Output is correct
12 Correct 348 ms 3128 KB Output is correct
13 Correct 190 ms 3180 KB Output is correct
14 Correct 202 ms 3180 KB Output is correct
15 Correct 233 ms 3180 KB Output is correct
16 Correct 227 ms 3180 KB Output is correct
17 Correct 328 ms 3180 KB Output is correct
18 Correct 143 ms 3180 KB Output is correct
19 Correct 120 ms 3180 KB Output is correct
20 Correct 141 ms 3180 KB Output is correct
21 Correct 157 ms 3180 KB Output is correct
22 Correct 158 ms 3180 KB Output is correct
23 Correct 142 ms 3180 KB Output is correct
24 Correct 144 ms 3180 KB Output is correct
25 Correct 181 ms 3180 KB Output is correct
26 Correct 261 ms 3180 KB Output is correct