Submission #834154

#TimeUsernameProblemLanguageResultExecution timeMemory
834154ALeonidouRadio Towers (IOI22_towers)C++17
0 / 100
4086 ms1360 KiB
#include "towers.h" #include <bits/stdc++.h> using namespace std; #define ll int #define sz(x) (ll)x.size() #define F first #define S second #define pb push_back #define MID ((l+r)/2) #define dbg(x) cout<<#x<<": "<<x<<endl; #define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl; #define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl; #define dbg5(x,y,z,a,b) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<" "<<#a<<": "<<a<<" "<<#b<<": "<<b<<endl; typedef vector <ll> vi; typedef pair <ll,ll> ii; typedef vector <ii> vii; typedef pair<ii,ii> i4; typedef pair <ll, i4> i5; void printVct(vi &v, string s = ""){ cout<<s<<": "; for (ll i=0; i<sz(v); i++){ cout<<v[i]<<" "; } cout<<endl; } ll k; ll n; vi v; void init(int N, vi H){ n = N; v = H; k =1; while (k<n && v[k] > v[k-1]){ k++; } k--; // dbg(k); } int max_towers(int l, int r, int d){ ll a =0, b= 0, val = v[k]-d; for (ll i=l; i<k; i++){ if (val >= v[i]) a++; } for (ll i =k+1; i<n; i++){ if (val >= v[i]) b++; } // dbg5(a,b, val, v[k], k); return min(a,b); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...