Submission #100905

#TimeUsernameProblemLanguageResultExecution timeMemory
100905autumn_eelSushi (JOI16_sushi)C++14
20 / 100
122 ms6656 KiB
#include <bits/stdc++.h> #define rep(i,n)for(int i=0;i<(n);i++) using namespace std; typedef long long ll; typedef pair<int,int>P; int x[3000]; int main(){ int n,q;cin>>n>>q; if(n<=2000&&q<=2000){ rep(i,n){ scanf("%d",&x[i]); } rep(i,q){ int s,t,p;scanf("%d%d%d",&s,&t,&p);s--;t--; int pos=s; while(1){ if(x[pos]>p){ swap(x[pos],p); } if(pos==t)break; (pos+=1)%=n; } printf("%d\n",p); } return 0; } priority_queue<int>que; rep(i,n){ int x;scanf("%d",&x); que.push(x); } rep(i,q){ int s,t,p;scanf("%d%d%d",&s,&t,&p); que.push(p); printf("%d\n",que.top()); que.pop(); } }

Compilation message (stderr)

sushi.cpp: In function 'int main()':
sushi.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&x[i]);
    ~~~~~^~~~~~~~~~~~
sushi.cpp:15:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    int s,t,p;scanf("%d%d%d",&s,&t,&p);s--;t--;
              ~~~~~^~~~~~~~~~~~~~~~~~~
sushi.cpp:30:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x;scanf("%d",&x);
         ~~~~~^~~~~~~~~
sushi.cpp:34:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int s,t,p;scanf("%d%d%d",&s,&t,&p);
             ~~~~~^~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...