제출 #1088171

#제출 시각아이디문제언어결과실행 시간메모리
1088171AlmontherBouquet (EGOI24_bouquet)C++98
8 / 100
97 ms22204 KiB
#include <bits/stdc++.h> #define suiii ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define ll long long #define co cout<< //#pragma GCC optimize("O3,Ofast,unroll-loops") //#pragma GCC target("avx2,sse3,sse4,avx") using namespace std; //stuff const ll N=exp2(ceil(log2(2e5))); ll tre[4*N]={}; ll sumof(ll l,ll r,ll i,ll lq,ll rq){ if(l>rq||r<lq) return 0; if(l>=lq&&r<=rq) return tre[i]; ll mid=(l+r)/2; return sumof(l,mid,i*2,lq,rq)|sumof(mid+1,r,i*2+1,lq,rq); } void solve(){ ll n; cin>>n; ll l[n+5],r[n+5],safe[n+5]={}; set<pair<ll,ll>>s; for(ll i=0;i<n;i++){ cin>>l[i]>>r[i]; l[i]=min(i,l[i]); r[i]=min(n-i-1,r[i]); s.insert({l[i]+r[i],i}); } ll ans=0; while(s.size()){ auto [val,idx]=*s.begin(); s.erase(s.begin()); if(sumof(0,N-1,1,idx-l[idx],idx+r[idx])==1) continue; idx+=N; ans++; tre[idx]=1; idx/=2; while(idx){ tre[idx]=tre[idx*2]|tre[idx*2+1]; idx/=2; } } co ans; } int main() { suiii int _=1; // cin>>_; while(_--) solve(); return 0; }

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

Main.cpp: In function 'void solve()':
Main.cpp:31:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   31 |         auto [val,idx]=*s.begin();
      |              ^
Main.cpp:21:22: warning: unused variable 'safe' [-Wunused-variable]
   21 |     ll l[n+5],r[n+5],safe[n+5]={};
      |                      ^~~~
#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...