///~~~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]=r;
}
o=0;
r=k-r;
for(int j=y;j>=0;j--){
if(o-c[j]>r) 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;
if(i<n-1) k-=w[i];
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
46 ms |
9964 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '37' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '37' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
1st lines differ - on the 1st token, expected: '30', found: '37' |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
1st lines differ - on the 1st token, expected: '6', found: '5' |
2 |
Halted |
0 ms |
0 KB |
- |