Submission #198920

# Submission time Handle Problem Language Result Execution time Memory
198920 2020-01-28T05:57:27 Z arnold518 복사 붙여넣기 2 (JOI15_copypaste2) C++14
100 / 100
316 ms 12536 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5;

int K, N;
ll A[MAXN+10], B[MAXN+10], C[MAXN+10], D[MAXN+10];
char S[MAXN+10];

int main()
{
	int i, j;

	scanf("%d%*d%s%d", &K, S, &N);
	for(i=1; i<=N; i++)
	{
		scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
		B[i]--;
		D[i]=C[i]+B[i]-A[i];
	}

	for(i=0; i<K; i++)
	{
		int pos=i;
		for(j=N; j>=1; j--)
		{
			if(C[j]<=pos && pos<=D[j]) pos=pos-C[j]+A[j];
			else if(D[j]<pos) pos-=D[j]-C[j]+1;
		}
		printf("%c", S[pos]);
	}
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%*d%s%d", &K, S, &N);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld%lld", &A[i], &B[i], &C[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 504 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 504 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 7 ms 376 KB Output is correct
9 Correct 309 ms 12536 KB Output is correct
10 Correct 154 ms 12536 KB Output is correct
11 Correct 154 ms 12408 KB Output is correct
12 Correct 316 ms 12408 KB Output is correct
13 Correct 140 ms 12280 KB Output is correct
14 Correct 137 ms 12280 KB Output is correct
15 Correct 142 ms 12280 KB Output is correct
16 Correct 140 ms 12408 KB Output is correct
17 Correct 278 ms 12156 KB Output is correct
18 Correct 114 ms 12408 KB Output is correct
19 Correct 118 ms 12408 KB Output is correct
20 Correct 115 ms 12504 KB Output is correct
21 Correct 131 ms 12372 KB Output is correct
22 Correct 139 ms 12408 KB Output is correct
23 Correct 156 ms 12460 KB Output is correct
24 Correct 182 ms 12408 KB Output is correct
25 Correct 245 ms 12408 KB Output is correct
26 Correct 304 ms 12408 KB Output is correct