Submission #979909

# Submission time Handle Problem Language Result Execution time Memory
979909 2024-05-11T15:46:01 Z vjudge1 Closing Time (IOI23_closing) C++17
Compilation error
0 ms 0 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 max_score(int n, int x, int y, ll k, int u[], int v[], int 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=0;
    for(int i=x;i>=0;i--)
        for(int j=x;j<y;j++)
            for(int kk=y;kk>x;kk--)
                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);
                    
                }
    cout<<ans<<endl;
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/cc4ULxbG.o: in function `main':
grader.cpp:(.text.startup+0x6a1): undefined reference to `max_score(int, int, int, long long, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status