답안 #980084

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980084 2024-05-11T22:25:28 Z leo_2727 봉쇄 시간 (IOI23_closing) C++17
0 / 100
47 ms 9704 KB
#include <algorithm>
#include <fstream>
#include <vector>
#include <queue>
#include <stack>
#include <iostream>
#include <cmath>
#include <queue>
#include <set>
#include <string>
#include <cstring>
#include <map>
#include <unordered_map>
#include <unordered_set>
#define F first
#define S second
#define PB push_back
using namespace std;
const long long MOD=1e9+7, INF=1e18;
const int INFI=1e9, N_MAX=200000;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<pair<int, ii>> viii;
typedef vector<vii> vvii;
typedef vector<ll> vll;
typedef vector<vll> vvll;
/*
int n, x, y;
ll k;
vi u(N_MAX), v(N_MAX), w(N_MAX);
//int max_score(int n, int x, int y, ll k, vi u, vi v, vi w)
 */
int max_score(int n, int x, int y, ll k, vi u, vi v, vi w){
    /*
    cin>>n>>x>>y>>k;
    for(int i=1;i<n;i++)    cin>>u[i-1];
    for(int i=1;i<n;i++)    cin>>v[i-1];
    for(int i=1;i<n;i++)    cin>>w[i-1];
     */
    vll cost1(n+1, INF), cost2(n+1, INF), c(n+1, 0);
    for(int i=0;i<n-1;i++){
        if(min(u[i], v[i])!=max(u[i], v[i])-1)  return 0;
        c[max(u[i], v[i])]=w[i];
    }
    cost1[x]=cost2[y]=0;
    for(int i=x+1;i<n;i++)  cost1[i]=cost1[i-1]+cost1[i-1]+c[i];
    for(int i=x-1;i>=0;i--)  cost1[i]=cost1[i+1]+cost1[i+1]+c[i+1];
    for(int i=y+1;i<n;i++)  cost2[i]=cost2[i-1]+cost2[i-1]+c[i];
    for(int i=y-1;i>=0;i--)  cost2[i]=cost2[i+1]+cost2[i+1]+c[i+1];
    int ans=2;
    for(int i=x;i>=0;i--){
        for(int j=x;j<y;j++){
            for(int kk=y;kk>x;kk--){
                if(kk<j)    break;
                for(int h=y;h<n;h++){
                    ll aux=cost1[i]+cost1[j]+cost2[kk]+cost2[h];
                    if(aux<=k)
                        ans=max(ans, (x-i)+(j-x)+(y-kk)+(h-y)+2);
                }
            }
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 47 ms 9704 KB 1st lines differ - on the 1st token, expected: '451', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '12'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '12'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '30', found: '12'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '6', found: '0'
2 Halted 0 ms 0 KB -