제출 #1078679

#제출 시각아이디문제언어결과실행 시간메모리
1078679Faisal_Saqib카니발 티켓 (IOI20_tickets)C++17
11 / 100
1 ms604 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define ll long long ll find_ans(vector<int>& cur) { vector<ll> pre={0}; for(auto i:cur) pre.push_back(pre.back()+(ll)i); ll mi=2e18; int n=cur.size(); for(int i=0;i<n;i++) { ll x=cur[i]; mi=min(mi,(x*i)-pre[i] + (pre[n]-pre[i])-((x*(n-i)))); } return mi; } long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); if(m==1) { vector<int> cur; for(int i=0;i<n;i++) { cur.push_back(x[i][0]); x[i][0]=0; } allocate_tickets(x); sort(begin(cur),end(cur)); return find_ans(cur); } std::vector<std::vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } 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...