제출 #343199

#제출 시각아이디문제언어결과실행 시간메모리
343199jenkinsserHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++17
0 / 100
3077 ms8344 KiB
#include<bits/stdc++.h> #define pb push_back #define mp make_pair #define st first #define nd second #define pii pair<int,int> #define N 1000005 #define INF 1e9+5 #define sp " " #define endl "\n" #define fastio() ios_base::sync_with_stdio(0);cin.tie(0); #define all(x) (x).begin(),(x).end() #define ll long long using namespace std; int n,m,w[N],s[N],l,r,k,rq,lq,mx1,mx2; int main(){ cin >> n >> m; for(int i=0;i<n;i++){ cin >> w[i]; s[i]=w[i]; } sort(s,s+n); for(int i=0;i<m;i++){ cin >> l >> r >> k; mx1=mx2=0; rq=lq=l; int j=l; while(j<=r&&w[j]==s[j]){ j++; } if(j>r){ continue; } lq=j; for(j;j<=r;j++){ if(w[j]!=s[j]){ rq=j; } } for(int j=lq;j<=rq;j++){ if(w[i]>mx1){ mx2=mx1; mx1=w[i]; } else if(w[i]<=mx1&&w[i]>mx2){ mx2=w[i]; } } if(mx1+mx2>k){ cout << 0 << endl; } else{ cout << 1 << endl; } } }

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

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:37:13: warning: statement has no effect [-Wunused-value]
   37 |         for(j;j<=r;j++){
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...