답안 #163188

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
163188 2019-11-11T17:56:20 Z TadijaSebez 복사 붙여넣기 2 (JOI15_copypaste2) C++11
100 / 100
267 ms 8668 KB
#include <bits/stdc++.h>
using namespace std;
const int N=200050;
char s[N];
int l[N],r[N],c[N];
int k,m,n;
char Solve(int x)
{
	for(int i=n;i>=1;i--)
	{
		if(x<=c[i]) continue;
		if(x>c[i]+(r[i]-l[i])) x-=r[i]-l[i];
		else x+=l[i]-c[i];
	}
	return s[x];
}
int main()
{
	scanf("%i %i",&k,&m);
	scanf("%s",s+1);
	scanf("%i",&n);
	for(int i=1;i<=n;i++) scanf("%i %i %i",&l[i],&r[i],&c[i]);
	for(int i=1;i<=k;i++) printf("%c",Solve(i));
	printf("\n");
	return 0;
}

Compilation message

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i %i",&k,&m);
  ~~~~~^~~~~~~~~~~~~~~
copypaste2.cpp:20:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
  ~~~~~^~~~~~~~~~
copypaste2.cpp:21:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
copypaste2.cpp:22:29: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(int i=1;i<=n;i++) scanf("%i %i %i",&l[i],&r[i],&c[i]);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 3 ms 376 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 257 ms 8556 KB Output is correct
10 Correct 141 ms 8568 KB Output is correct
11 Correct 140 ms 8540 KB Output is correct
12 Correct 266 ms 8668 KB Output is correct
13 Correct 178 ms 8448 KB Output is correct
14 Correct 131 ms 8380 KB Output is correct
15 Correct 130 ms 8312 KB Output is correct
16 Correct 173 ms 8376 KB Output is correct
17 Correct 267 ms 8164 KB Output is correct
18 Correct 105 ms 8520 KB Output is correct
19 Correct 239 ms 8440 KB Output is correct
20 Correct 109 ms 8552 KB Output is correct
21 Correct 120 ms 8600 KB Output is correct
22 Correct 126 ms 8440 KB Output is correct
23 Correct 139 ms 8440 KB Output is correct
24 Correct 158 ms 8440 KB Output is correct
25 Correct 207 ms 8440 KB Output is correct
26 Correct 255 ms 8444 KB Output is correct