Submission #56889

# Submission time Handle Problem Language Result Execution time Memory
56889 2018-07-13T05:19:33 Z 정원준(#1637) 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
341 ms 25312 KB
#include <bits/stdc++.h>
#define L long long


using namespace std;

L k,m,q;
char str[200020];
L s[200020],e[200020],c[200020];

L f(L now,L query){
	if(query==0) return now;
	if(now<=c[query]) return f(now,query-1);
	if(c[query]<now&&now<=c[query]+e[query]-s[query]) return f(now+s[query]-c[query],query-1);
	else return f(now-e[query]+s[query],query-1);
}

int main()
{
	scanf("%lld %lld %s %lld",&k,&m,str,&q);
	L i;
	for(i=1;i<=q;i++)
	{
		scanf("%lld %lld %lld",&s[i],&e[i],&c[i]);
	}
	for(i=1;i<=k;i++)
	{
		//printf("%lld",f(i,q));
		printf("%c",str[f(i,q)-1]);
	}
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld %lld %s %lld",&k,&m,str,&q);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
copypaste2.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld %lld",&s[i],&e[i],&c[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 492 KB Output is correct
3 Correct 6 ms 492 KB Output is correct
4 Correct 4 ms 644 KB Output is correct
5 Correct 3 ms 716 KB Output is correct
6 Correct 4 ms 716 KB Output is correct
7 Correct 4 ms 784 KB Output is correct
8 Correct 6 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 492 KB Output is correct
3 Correct 6 ms 492 KB Output is correct
4 Correct 4 ms 644 KB Output is correct
5 Correct 3 ms 716 KB Output is correct
6 Correct 4 ms 716 KB Output is correct
7 Correct 4 ms 784 KB Output is correct
8 Correct 6 ms 784 KB Output is correct
9 Correct 341 ms 11228 KB Output is correct
10 Correct 187 ms 17128 KB Output is correct
11 Correct 180 ms 22784 KB Output is correct
12 Correct 339 ms 25156 KB Output is correct
13 Correct 119 ms 25268 KB Output is correct
14 Correct 142 ms 25312 KB Output is correct
15 Correct 166 ms 25312 KB Output is correct
16 Correct 187 ms 25312 KB Output is correct
17 Correct 304 ms 25312 KB Output is correct
18 Correct 121 ms 25312 KB Output is correct
19 Correct 118 ms 25312 KB Output is correct
20 Correct 132 ms 25312 KB Output is correct
21 Correct 131 ms 25312 KB Output is correct
22 Correct 151 ms 25312 KB Output is correct
23 Correct 182 ms 25312 KB Output is correct
24 Correct 207 ms 25312 KB Output is correct
25 Correct 281 ms 25312 KB Output is correct
26 Correct 281 ms 25312 KB Output is correct