제출 #343270

#제출 시각아이디문제언어결과실행 시간메모리
343270fixikmilaHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 typedef long long ll; typedef pair<ll,ll>pll; typedef long double ld; ll bin_pow(ll a,ll b){ if(b==0)return 1; if(b%2==0){ ll t=bin_pow(a,b/2); return t*t%MOD; } else return a*bin_pow(a,b-1)%MOD; } struct cat{ll a,b;}; cat tree[20001]; ll a[5001]; void build_tree(ll v,ll tl,ll tr){ if(tl==tr)tree[v].a=tl,tree[v].b=a[tl]; else{ ll tm=(tl+tr)/2; build_tree(2*v,tl,tm),build_tree(2*v+1,tm+1,tr); if(tree[2*v].b>tree[2*v+1].b)tree[v].a=tree[2*v].a,tree[v].b=tree[2*v].b; else tree[v].a=tree[2*v+1].a,tree[v].b=tree[2*v+1].b; } } cat get_max(ll l,ll r,ll v,ll tl,ll tr){ if(tl>=l&&tr<=r)return tree[v]; else if(tl>r||tr<r){ cat f; f.b=LLONG_MIN; return f; } ll tm=(tl+tr)/2; cat f=get_max(l,r,2*v,tl,tm),f1=get_max(l,r,2*v+1,tm+1,tr),f2; if(f.b>f1.b)f2.a=f.a,f2.b=f.b; else f2.a=f1.a,f2.b=f1.b; return f2; } int main() { //freopen("stones.in","r",stdin); //freopen("stones.out","w",stdout); ios::sync_with_stdio(false); cin.tie(0); ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN; cin>>n>>m; for(int i=0;i<n;i++)cin>>a[i],mx=max(mx,a[i]),c[a[i]].push_back(i); for(int i=0;i<m;i++){ cin>>l>>r>>k; l--,r--; z=1; ll mx1=-1,v; vector<ll>b; for(int j=l;j<=r;j++)b.push_back(a[j]); sort(b.begin(),b.end()); for(int j=ll(b.size())-1;j>=0;j--){ //cout<<a[l+j]<<"gggg"; if(b[j]>a[l+j]){ mx1=max(mx1,b[j]+a[l+j]); } } //cout<<mx1<<"uu"<<endl; if(mx1<=k)z=1; else z=0; cout<<z; cout<<"\n"; } return 0; }

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

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:48:51: error: 'c' was not declared in this scope
   48 |     for(int i=0;i<n;i++)cin>>a[i],mx=max(mx,a[i]),c[a[i]].push_back(i);
      |                                                   ^
sortbooks.cpp:53:27: warning: unused variable 'v' [-Wunused-variable]
   53 |                 ll mx1=-1,v;
      |                           ^
sortbooks.cpp:46:8: warning: unused variable 't' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |        ^
sortbooks.cpp:46:20: warning: unused variable 'sum' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |                    ^~~
sortbooks.cpp:46:34: warning: unused variable 'x' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |                                  ^
sortbooks.cpp:46:38: warning: unused variable 'y' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |                                      ^
sortbooks.cpp:46:46: warning: unused variable 'ans' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |                                              ^~~
sortbooks.cpp:46:52: warning: unused variable 'mn' [-Wunused-variable]
   46 |     ll t=1,n,m,k=0,sum=0,l=0,r=0,x=0,y=0,z=0,ans=0,mn=LLONG_MAX,mx=LLONG_MIN;
      |                                                    ^~