제출 #300603

#제출 시각아이디문제언어결과실행 시간메모리
300603muhammad_hokimiyon카니발 티켓 (IOI20_tickets)C++14
16 / 100
772 ms52716 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> #define fi first #define se second #define ll long long using namespace std; long long find_maximum(int k, vector<vector<int>> X) { int n = X.size(); int m = X[0].size(); ll res1 = 0; vector < int > ls( m , m - 1 ) , st( m , 0 ); vector < vector < int > > ans( n , vector < int > (m , -1) ); for( int it = 0; it < k; it++ ){ vector < pair < ll , int > > res; ll cnt = 0; for( int i = 0; i < n; i++ ){ res.push_back({ -X[i][st[i]] - X[i][ls[i]] , i }); cnt += X[i][ls[i]]; } sort( res.rbegin() , res.rend() ); for( int i = 0; i < n / 2; i++ ){ ans[res[i].se][st[res[i].se]++] = it; cnt += res[i].fi; } for( int i = n / 2; i < n; i++ ){ ans[res[i].se][ls[res[i].se]--] = it; } res1 += cnt; } allocate_tickets( ans ); return res1; }
#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...