Submission #751357

# Submission time Handle Problem Language Result Execution time Memory
751357 2023-05-31T12:25:07 Z coding_snorlax Cyberland (APIO23_cyberland) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
//#include "cyberland.h"
using namespace std;
using ll = long long int;
double dis[100002];
double solve(int N,int M,int K,int H, vector<int> x,vector<int> y,vector<int> c,vector<int> arr){
    for(int i=0;i<N;i++) dis[i]=0;
    long long int Max_0=-1,Max_2=-1;
    double answer = 0;
    for(int i=0;i<H;i++){
        if(arr[i+1]==0){ Max_0 = i+1; answer=0;}
        else if(arr[i+1]==1) answer+=c[i];
        else {Max_2 = i+1; answer += c[i];}
        dis[i+1] = answer;
    }
    if(Max_0<Max_2){
        long long int check = min(c[Max_2-1],c[Max_2]);
        answer = dis[Max_2]/2;
        cout << answer << "\n";
        K--;
        for(int i=0;i<K;i++){
            double comp = (answer + 2.0 * check) / 2.0;
            if(comp < answer) answer = comp;
            cout << answer << "\n";
        }
        for(int i = Max_2 ; i<H;i++){
            answer += c[i];
        }

    }
    cout << Max_2 << "\n";
    return answer;
}
int main(){
    int T;
    cin>>T;
    for(int s=0;s<T;s++){
        int N,M,K,H;
        cin>>N>>M>>K>>H;
        vector<int> x,y,c,arr;
        for(int i=0;i<N;i++){
            int tmp;
            cin>>tmp;
            arr.push_back(tmp);
        }

        for(int i=0;i<M;i++){
            int tmp1,tmp2,tmp3;
            cin>>tmp1>>tmp2>>tmp3;
            x.push_back(tmp1);
            y.push_back(tmp2);
            c.push_back(tmp3);
        }
        cout << solve(N,M,K,H,x,y,c,arr) << "\n";
    }
}

Compilation message

/usr/bin/ld: /tmp/cczpWWb5.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDdBgG2.o:cyberland.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status