제출 #212607

#제출 시각아이디문제언어결과실행 시간메모리
212607urd05Sushi (JOI16_sushi)C++14
5 / 100
12017 ms7952 KiB
#include <bits/stdc++.h>
using namespace std;

long long arr[400000];

int main(void) {
	int n,q;
	scanf("%d %d\n",&n,&q);
	for(int i=0;i<n;i++) {
		scanf("%lld\n",&arr[i]);
	}
	for(int i=0;i<q;i++) {
		int s,t,p;
		scanf("%d %d %d\n",&s,&t,&p);
		s--;
		t--;
		long long big=p;
		int cnt=0;
		for(int i=s;cnt==0||i!=(t+1)%n;i=(i+1)%n) {
			if (arr[i]>big) {
				swap(arr[i],big);
			}
			cnt++;
		}
		printf("%lld\n",big);
	}
}

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

sushi.cpp: In function 'int main()':
sushi.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d\n",&n,&q);
  ~~~~~^~~~~~~~~~~~~~~~~
sushi.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld\n",&arr[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~
sushi.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d %d\n",&s,&t,&p);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...