Submission #1069774

#TimeUsernameProblemLanguageResultExecution timeMemory
1069774Sir_Ahmed_ImranClosing Time (IOI23_closing)C++17
9 / 100
968 ms10068 KiB
///~~~LOTA~~~/// #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 3000 ll c[N]; int max_score(int n,int x,int y,ll k,vector<int> u,vector<int> v,vector<int> w){ int m,t,ans; ll o,p,q,r,s; ans=m=0; if(x>y) swap(x,y); priority_queue<pair<ll,pll>,vector<pair<ll,pll>>,greater<pair<ll,pll>>> Q; for(int i=x;i<n;i++){ r=0; for(int j=x;j<i;j++){ r+=w[j]; c[j+1]=r; } o=0; r=k; for(int j=x+1;j<=i;j++) r-=c[j]; for(int j=y;j>=0;j--){ if(o-c[j]>r || r<0) break; r-=max(0LL,o-c[j]); c[j]=max(c[j],o); m=i-x+y-j; s=r; Q.push({0,{0,x}}); Q.push({0,{0,y}}); while(!Q.empty() && Q.top().ff<=s){ p=Q.top().ff; q=Q.top().ss.ff; t=Q.top().ss.ss; Q.pop(); s-=p; m++; if(t<=x && t){ q+=w[t-1]; p=max(0LL,q-c[t-1]); Q.push({p,{q,t-1}}); } if(t>=y && t<n-1){ q+=w[t]; p=max(0LL,q-c[t+1]); Q.push({p,{q,t+1}}); } } ans=max(ans,m); if(j) o+=w[j-1]; } for(int j=0;j<n;j++) c[j]=0; } return ans; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...