제출 #424996

#제출 시각아이디문제언어결과실행 시간메모리
424996Mlxa카니발 티켓 (IOI20_tickets)C++14
27 / 100
731 ms73116 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define all(x) x.begin(), x.end() #define mp make_pair #define mt make_tuple #define x first #define y second #include "tickets.h" #include <vector> ll find_maximum(int k, vector<vector<int>> x) { int n = (int)x.size(); int m = (int)x[0].size(); assert(k == 1); vector<vector<int>> answer(n, vector<int>(m, -1)); vector<int> ord(n); iota(all(ord), 0); sort(all(ord), [&](int i, int j) { return x[i].front() + x[i].back() < x[j].front() + x[j].back(); }); ll sum = 0; for (int i = 0; i < n / 2; ++i) { sum -= x[ord[i]].front(); answer[ord[i]].front() = 0; } for (int i = n / 2; i < n; ++i) { sum += x[ord[i]].back(); answer[ord[i]].back() = 0; } allocate_tickets(answer); return sum; } #ifdef LC #include "grader.cpp" #endif
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...