Submission #1088173

#TimeUsernameProblemLanguageResultExecution timeMemory
1088173AlmontherBouquet (EGOI24_bouquet)C++98
0 / 100
3049 ms17652 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 void solve(){ ll n; cin>>n; ll l[n+5],r[n+5],took[n+5]={}; set<pair<ll,ll>>s; for(ll i=1;i<=n;i++){ cin>>l[i]>>r[i]; l[i]=min(i-1,l[i]); r[i]=min(n-i,r[i]); s.insert({l[i]+r[i],i}); } ll ans=0; while(s.size()){ auto [val,idx]=*s.begin(); s.erase(s.begin()); bool fla=0; for(int i=idx-l[idx];i<=idx+r[idx];i++) fla|=took[i]; if(fla) continue; took[idx]=1; ans++; } co ans; } int main() { suiii int _=1; // cin>>_; while(_--) solve(); return 0; }

Compilation message (stderr)

Main.cpp: In function 'void solve()':
Main.cpp:24:14: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   24 |         auto [val,idx]=*s.begin();
      |              ^
#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...