답안 #980609

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980609 2024-05-12T09:20:38 Z zh_h 육각형 영역 (APIO21_hexagon) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define lint long long int
#define pb push_back
using namespace std;

const int INF = 1e9;

lint draw_territory(int N, int A, int B, int D[], int L[]){


    // vector<vector<int>> v1(1e9, vector<int>(1e9)), v2, v3, v4;
    // v1.resize(INF, );
    // v2.resize(N+1);
    // v3.resize(N+1);
    // v4.resize(N+1);

    int length = L[0]+1;
    int sum = 0, times = 0;
    for(int i = 0; i <= length; i ++){
        sum += (i*(i+1));
        times += i+1;
    }
    sum *= B;
    sum += (times*A);
    return sum;
    
}


int main(){
    
    int D[] = {1, 2, 3, 4, 5, 4, 3, 2, 1, 6, 2, 3, 4, 5, 6, 6, 1};
    int L[] = {1, 2, 2, 1, 1, 1, 1, 2, 3, 2, 3, 1, 6, 3, 3, 2, 1};
    cout << draw_territory(17, 2, 3, D, L);
}

Compilation message

/usr/bin/ld: /tmp/ccLlSiju.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccwFIJ9r.o:hexagon.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccLlSiju.o: in function `main':
grader.cpp:(.text.startup+0x228): undefined reference to `draw_territory(int, int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status