답안 #1069738

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069738 2024-08-22T08:37:12 Z Sir_Ahmed_Imran 봉쇄 시간 (IOI23_closing) C++17
0 / 100
44 ms 9964 KB
                            ///~~~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;
    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;
            Q.push({0,{0,x}});
            Q.push({0,{0,y}});
            while(!Q.empty() && Q.top().ff<=r){
                p=Q.top().ff;
                q=Q.top().ss.ff;
                t=Q.top().ss.ss;
                c[t]+=p;
                Q.pop();
                r-=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];
        }
        if(i<n-1) k-=w[i];
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 44 ms 9964 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '40'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '40'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '40'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '7'
2 Halted 0 ms 0 KB -