제출 #212739

#제출 시각아이디문제언어결과실행 시간메모리
212739urd05Sushi (JOI16_sushi)C++14
20 / 100
123 ms11488 KiB
#include <bits/stdc++.h> using namespace std; long long arr[400000]; int main(void) { int n,q; scanf("%d %d\n",&n,&q); if (n<=2000&&q<=2000) { 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); } } else { priority_queue<long long> pq; for(int i=0;i<n;i++) { scanf("%lld\n",&arr[i]); pq.push(arr[i]); } for(int i=0;i<q;i++) { int s,t,p; scanf("%d %d %d\n",&s,&t,&p); pq.push(p); printf("%lld\n",pq.top()); pq.pop(); } } }

컴파일 시 표준 에러 (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:11:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld\n",&arr[i]);
    ~~~~~^~~~~~~~~~~~~~~~~~
sushi.cpp:15:9: 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);
    ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
sushi.cpp:32:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%lld\n",&arr[i]);
    ~~~~~^~~~~~~~~~~~~~~~~~
sushi.cpp:37:9: 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...