제출 #677448

#제출 시각아이디문제언어결과실행 시간메모리
677448onjo0127복사 붙여넣기 2 (JOI15_copypaste2)C++11
100 / 100
229 ms3656 KiB
#include <bits/stdc++.h>
using namespace std;

char S[200009];
int A[200009], B[200009], C[200009];

int main() {
	int K, M; scanf("%d%d", &K, &M);
	scanf(" %s", S);
	int N; scanf("%d", &N);
	for(int i=0; i<N; i++) scanf("%d%d%d", &A[i], &B[i], &C[i]);
	for(int i=0; i<K; i++) {
		int f = i;
		for(int j=N-1; j>=0; j--) {
			if(C[j] <= f && f < C[j] + B[j] - A[j]) {
				f = A[j] + f - C[j];
			}
			else if(C[j] <= f) {
				f -= B[j] - A[j];
			}
		}
		printf("%c", S[f]);
	}
	return 0;
}

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

copypaste2.cpp: In function 'int main()':
copypaste2.cpp:8:17: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |  int K, M; scanf("%d%d", &K, &M);
      |            ~~~~~^~~~~~~~~~~~~~~~
copypaste2.cpp:9:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |  scanf(" %s", S);
      |  ~~~~~^~~~~~~~~~
copypaste2.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |  int N; scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~
copypaste2.cpp:11:30: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  for(int i=0; i<N; i++) scanf("%d%d%d", &A[i], &B[i], &C[i]);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...