제출 #415913

#제출 시각아이디문제언어결과실행 시간메모리
415913abdzag카니발 티켓 (IOI20_tickets)C++17
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "tickets.h" #define rep(i,a,b) for(int i=int(a);i<int(b);i++) #define rrep(i,a,b) for(int i=int(a);i>int(b);i--) #define trav(a,v) for(auto& a: v) #define sz(v) v.size() #define all(v) v.begin(),v.end() #define vi vector<int> typedef long long ll; typedef long double ld; typedef unsigned long long ull; const long long inf = 1e15; using namespace std; vector<bool> visited(1e6); vector<vector<ll>> g; vector<ll> v; ll curr = 0; bool done = 1; void allocate_tickets(vector<vector<int>> answer) { trav(a, answer) { trav(b, a) { cout << b << " "; } cout << endl; } } long long find_maximum(int k, std::vector<std::vector<int>> x) { vector<ll> v; ll n = x.size(); ll m = x[0].size(); ll ans = 0; std::vector<std::vector<int>> answer(x.size(),vector<int>(x[0].size(),-1)); set<pair<ll, pair<ll, ll>>> greatest; set<pair<ll, pair<ll, ll>>> smallest; vector<bool> visited(n); rep(i, 0, k) { visited.clear(); v.clear(); visited.resize(n, 0); smallest.clear(); greatest.clear(); rep(j, 0, n) { rep(z, 0, m) { if (x[j][z] != -1) { smallest.emplace(x[j][z], make_pair(j, z)); break; } } rrep(z, m-1, -1) { if (x[j][z] != -1) { greatest.emplace(-x[j][z], make_pair(j, z)); break; } } } ll counter = 0; trav(a, smallest) { x[a.second.first][a.second.second] = -1; answer[a.second.first][a.second.second] = i; visited[a.second.first] = 1; v.push_back(a.first); counter++; if (counter == n / 2)break; } counter = 0; trav(a, greatest) { if (!visited[a.second.first]) { answer[a.second.first][a.second.second] = i; x[a.second.first][a.second.second] = -1; v.push_back(-a.first); counter++; } if (counter == n / 2)break; } sort(all(v)); ll b = v[v.size() / 2]; trav(a, v) { ans += abs(a - b); } } allocate_tickets(answer); return ans; }

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

/usr/bin/ld: /tmp/cc3ZKo4b.o: in function `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x260): multiple definition of `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'; /tmp/ccv1Wh7b.o:tickets.cpp:(.text+0x570): first defined here
collect2: error: ld returned 1 exit status