제출 #362047

#제출 시각아이디문제언어결과실행 시간메모리
362047Sorting카니발 티켓 (IOI20_tickets)C++17
0 / 100
1 ms512 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; const int N = 1500 + 3; vector<vector<int>> x, answer; int n, m, k, l[N], r[N]; array<int, 2> arr[N]; void clear(){ } void solve(){ clear(); for(int i = 0; i < n; ++i) l[i] = 0, r[i] = m - 1; for(int i = 0; i < k; ++i){ for(int j = 0; j < n; ++j) arr[j] = array{x[j][l[j]] + x[j][r[j]], j}; sort(arr, arr + n, greater<array<int, 2>>()); for(int j = 0; j < n / 2; ++j){ int idx = arr[j][1]; answer[idx][r[idx]] = i; r[idx]--; } for(int j = n / 2; j < n; ++j){ int idx = arr[j][1]; answer[idx][l[idx]] = i; l[idx]++; } } } long long find_maximum(int _k, vector<vector<int>> _x) { k = _k; x = _x; n = x.size(); m = x[0].size(); answer.clear(); answer.resize(n, vector<int>(m, -1)); solve(); allocate_tickets(answer); return 1; }
#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...