제출 #343945

#제출 시각아이디문제언어결과실행 시간메모리
343945fixikmilaHedgehog Daniyar and Algorithms (IZhO19_sortbooks)C++14
0 / 100
1535 ms106740 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,c;}; vector<cat>b[1000000]; ll a[1000000],c[1000000],f[1000000]; ll tree[4000001]; void update(ll l,ll x,ll v,ll tl,ll tr){ if(tl==l&&tr==tl)tree[v]=f[l]=x; else if(tl>l||tr<l){ return; } else{ ll tm=(tl+tr)/2; update(l,x,2*v,tl,tm),update(l,x,2*v+1,tm+1,tr); } } ll 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<l)return LLONG_MIN; else{ ll tm=(tl+tr)/2; return max(get_max(l,r,2*v,tl,tm),get_max(l,r,2*v+1,tm+1,tr)); } } 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]; for(int i=0;i<m;i++){ cin>>l>>r>>k; l--,r--; cat f; f.a=l,f.b=k,f.c=i; b[r].push_back(f); } stack<ll>s; for(int i=0;i<n;i++){ while(s.size()&&a[s.top()]<=a[i])s.pop(); if(s.size()){ ll j=s.top(); update(j,a[i]+a[j],1,0,n-1); } s.push(i); for(auto u : b[i]){ l=u.a,k=u.b; ll nom=u.c; c[nom]=get_max(l,n-1,1,0,n-1)<=k?1:0; } } for(int i=0;i<m;i++)cout<<c[i]<<"\n"; return 0; }

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

sortbooks.cpp: In function 'int main()':
sortbooks.cpp:43:8: warning: unused variable 't' [-Wunused-variable]
   43 |     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:43:20: warning: unused variable 'sum' [-Wunused-variable]
   43 |     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:43:34: warning: unused variable 'x' [-Wunused-variable]
   43 |     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:43:38: warning: unused variable 'y' [-Wunused-variable]
   43 |     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:43:42: warning: unused variable 'z' [-Wunused-variable]
   43 |     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:43:46: warning: unused variable 'ans' [-Wunused-variable]
   43 |     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:43:52: warning: unused variable 'mn' [-Wunused-variable]
   43 |     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:43:65: warning: unused variable 'mx' [-Wunused-variable]
   43 |     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;
      |                                                                 ^~
#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...