제출 #163188

#제출 시각아이디문제언어결과실행 시간메모리
163188TadijaSebez복사 붙여넣기 2 (JOI15_copypaste2)C++11
100 / 100
267 ms8668 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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]);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...