제출 #304427

#제출 시각아이디문제언어결과실행 시간메모리
304427urd05카니발 티켓 (IOI20_tickets)C++14
컴파일 에러
0 ms0 KiB
//#include "tickets.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;

static int n;
static int m;
static int k;
static std::vector<std::vector<int>> d;
static std::vector<std::vector<int>> x;
static int called = 0;

static void check(bool cond, std::string message) {
    if (!cond) {
        printf("%s\n", message.c_str());
        exit(0);
    }
}


void allocate_tickets( std::vector<std::vector<int>> _d) {
    check(!called, "allocate_tickets called more than once");
    d = _d;
    check((int)d.size() == n, "allocate_tickets called with parameter of wrong size");
    for (int i = 0; i < n; i++) {
        check((int)d[i].size() == m, "allocate_tickets called with parameter of wrong size");
    }
    called = 1;
}

long long dp[81][6400];
const long long INF=1e16;

long long find_maximum(int k, vector<vector<int>> v) {
	int n = v.size();
	int m = v[0].size();
	vector<vector<int>> answer(n,vector<int>(m));
  vector<int> temp;
  for(int i=0;i<n;i++) {
    temp.push_back(v[i][0]);
    answer[i][0]=0;
    for(int j=1;j<m;j++) {
      answer[i][j]=-1;
    }
  }
  sort(temp.begin(),temp.end());
  long long ret=0;
  for(int i=0;i<n/2;i++) {
    ret-=temp[i];
  }
  for(int i=n/2;i<n;i++) {
    ret+=temp[i];
  }
	allocate_tickets(answer);
	return ret;
}

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp:8:12: warning: 'k' defined but not used [-Wunused-variable]
    8 | static int k;
      |            ^
/tmp/cc8txTD4.o: In function `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x1f0): multiple definition of `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/tmp/cczUgL2N.o:tickets.cpp:(.text+0x20): first defined here
collect2: error: ld returned 1 exit status