Submission #384238

#TimeUsernameProblemLanguageResultExecution timeMemory
384238Osama_AlkhodairyCarnival Tickets (IOI20_tickets)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //~ #include "tickets.h" #include "grader.cpp" using namespace std; #define ll long long ll find_maximum(int k, vector <vector <int> > x) { int n = x.size(); int m = x[0].size(); ll res = 0; for(int i = 0 ; i < n ; i++){ for(int j = m - k ; j < m ; j++){ res += x[i][j]; } } vector <vector <int> > g(n, vector <int>(k)); for(int i = 0 ; i < n ; i++){ for(int j = 0 ; j < m ; j++){ g[i][j] = x[i][j] + x[i][m - k + j]; } } set <pair <int, int> > s; for(int i = 0 ; i < n ; i++){ s.insert(make_pair(g[i][0], i)); } vector <int> cnt(n); for(int i = 0 ; i < n * k / 2 ; i++){ int row = s.begin()->second; s.erase(s.begin()); res -= g[row][cnt[row]]; cnt[row]++; if(cnt[row] < k){ s.insert(make_pair(g[row][cnt[row]], row)); } } vector <pair <int, int> > all(n); for(int i = 0 ; i < n ; i++){ all[i] = make_pair(cnt[i], i); } vector <vector <int> > answer(n, vector <int>(m, -1)); vector <int> l(n), r(n, m - 1); for(int i = 0 ; i < k ; i++){ sort(all.rbegin(), all.rend()); for(int j = 0 ; j < n ; j++){ int row = all[j].second; if(j < n / 2){ answer[row][l[row]++] = i; all[j].first--; } else{ answer[row][r[row]--] = i; } } } allocate_tickets(answer); return res; }

Compilation message (stderr)

/tmp/ccWTQ8Gs.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc5rCgQn.o:tickets.cpp:(.text.startup+0x0): first defined here
/tmp/ccWTQ8Gs.o: In function `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)':
grader.cpp:(.text+0x100): multiple definition of `allocate_tickets(std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
/tmp/cc5rCgQn.o:tickets.cpp:(.text+0x100): first defined here
collect2: error: ld returned 1 exit status