제출 #320387

#제출 시각아이디문제언어결과실행 시간메모리
320387tigicha카니발 티켓 (IOI20_tickets)C++17
100 / 100
1000 ms60772 KiB
#include "tickets.h" #include<bits/stdc++.h> using namespace std; long long l, x, y, a[500005], sum, n, m; set<pair<int, int> >s; vector<vector<int> >answer; vector<int>vec; long long find_maximum(int k, vector<vector<int> >v){ n=v.size(); m=v[0].size(); for(int i=0; i<n; i++){ for(int j=m-k; j<m; j++) sum+=v[i][j]; s.insert({v[i][m-k]+v[i][0], i}); } for(int i=1; i<=(k*n)/2; i++){ l=(*s.begin()).second; sum-=(*s.begin()).first; s.erase(*s.begin()); a[l]++; if(a[l]<k) s.insert({v[l][m-k+a[l]]+v[l][a[l]], l}); } for(int i=0; i<n; i++){ vec.clear(); for(int j=0; j<a[i]; j++){ vec.push_back(x); x=(x+1)%k; } for(int j=a[i]; j<m-k+a[i]; j++) vec.push_back(-1); y=x; for(int j=m-k+a[i]; j<m; j++){ vec.push_back(y); y=(y+1)%k; } answer.push_back(vec); } allocate_tickets(answer); return sum; }
#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...