제출 #304804

#제출 시각아이디문제언어결과실행 시간메모리
304804arthur_nascimento카니발 티켓 (IOI20_tickets)C++14
16 / 100
746 ms52856 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define maxn 1515 #define pii pair<int,int> int ini[maxn]; int fim[maxn]; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); std::vector<std::vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row(m); for (int j = 0; j < m; j++) { row[j] = -1; } answer.push_back(row); } long long ans = 0; set<pii> S; for(int i=0;i<n;i++){ for(int j=m-k;j<m;j++){ ans += x[i][j]; answer[i][j] = -2; } ini[i] = 0; fim[i] = m-k; S.insert({x[i][ini[i]] + x[i][fim[i]],i}); } for(int i=0;i<(k*n)/2;i++){ pii u = *S.begin(); S.erase(S.begin()); ans -= u.first; int id = u.second; answer[id][ini[id]] = -3; ini[id]++; answer[id][fim[id]] = -1; fim[id]++; if(fim[id] < m){ S.insert({x[id][ini[id]] + x[id][fim[id]],id}); } } int cur = 0, curcur = 0; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ if(answer[i][j] == -3){ answer[i][j] = cur; cur = (cur+1) % k; curcur = cur; } if(answer[i][j] == -2){ answer[i][j] = curcur; curcur = (curcur+1) % k; } } //cur = curcur; } allocate_tickets(answer); return ans; }
#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...