제출 #301205

#제출 시각아이디문제언어결과실행 시간메모리
301205naderjemel카니발 티켓 (IOI20_tickets)C++14
16 / 100
909 ms54596 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>> answer; answer.resize(n,vector<int>()); long long s=0; if(m==1){ vector<int> nums; for (int i = 0; i < n; i++) { vector<int> row(m); for (int j = 0; j < m; j++) { row[j] = j; nums.push_back(x[i][j]); } answer.push_back(row); } sort(nums.begin(),nums.end()); for(int i=0;i<n;i++){ if(i<n/2) s-=nums[i]; else s+=nums[i]; } } else if(k==1){ for(int i=0;i<n;i++) for(int j = 0; j < m; j++) answer[i].push_back(-1); vector<pair<int,int>> mini; for(int i=0;i<n;i++) mini.push_back({x[i][m-1]+x[i][0],i}); sort(mini.begin(),mini.end()); for(int i=0;i<n;i++){ if(i<n/2){ s-=x[mini[i].second][0]; answer[mini[i].second][0]=0; } else{ s+=x[mini[i].second][m-1]; answer[mini[i].second][m-1]=0; } } } allocate_tickets(answer); return s; }
#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...