제출 #1183820

#제출 시각아이디문제언어결과실행 시간메모리
1183820asdfghjkHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++20
8 / 100
3095 ms8328 KiB
#include <bits/stdc++.h> #define pb push_back #define all(x) x.begin(), x.end() #define F first #define S second #define con continue using namespace std; typedef long long ll; typedef double db; typedef long double ld; const ll N = 1e6 + 5; const ll inf = 1e9; const ll INF = 1e18; const ll MOD = 1e9 + 7; int a[N],b[N],c[N]; void solve(){ int n,m;cin >> n >> m; for(int i= 1;i <= n;i++){ cin >> a[i]; } while(m--){ int l,r,k;cin >> l >> r >> k; int d = (r - l + 1); for(int i = 1;i <= d;i++){ b[i] = a[l + (i - 1)]; c[i] = a[l + (i - 1)]; } int mx = 0; for(int i = d-1;i > 0;i--){ int j = i; while(b[j] > b[j+1] && j < d){ mx = max(mx,(b[j] + b[j+1])); swap(b[j],b[j+1]); j++; } } if(mx > k){ cout << "0\n"; } else cout << "1\n"; } } main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--){ solve(); } }

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

sortbooks.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   44 | main(){
      | ^~~~
#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...