제출 #311032

#제출 시각아이디문제언어결과실행 시간메모리
311032Jarif_Rahman카니발 티켓 (IOI20_tickets)C++17
11 / 100
3 ms1792 KiB
#include "tickets.h" #include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; deque<deque<int>> r; int n, m; long long find_maximum(int k, vector<vector<int>>rrrr){ n = rrrr.size(), m = rrrr[0].size(); for(int i = 0; i < n; i++){ r.pb({}); for(int j = 0; j < m; j++) r[i].pb(rrrr[i][j]); } ll s = 0; vector <vector<int>> ans(n, vector<int>(m, -1)); for(int i = 0; i < m; i++){ vector <ll> v; for(int j = 0; j < n; j++){ if(j%2 == 0){ v.pb(r[j].front()); r[j].pop_front(); ans[j][i] = i; } else{ v.pb(r[j].back()); r[j].pop_back(); ans[j][m - i - 1] = i; } } sort(v.begin(), v.end()); ll b = (v[n/2] + v[n/2 - 1])/2; for(ll x: v) s+=abs(x - b); } allocate_tickets(ans); 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...