제출 #1078933

#제출 시각아이디문제언어결과실행 시간메모리
1078933Sir_Ahmed_Imran카니발 티켓 (IOI20_tickets)C++17
27 / 100
445 ms73036 KiB
///~~~LOTA~~~/// #include "tickets.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define append push_back #define add insert #define nl '\n' #define ff first #define ss second #define pii pair<int,int> #define pll pair<ll,ll> #define all(x) (x).begin(),(x).end() #define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define terminator main #define N 1501 int a[N]; ll find_maximum(int k,vector<vector<int>> x){ pair<ll,vector<int>> ans={0,{}}; vector<int> u; ll r; int n=x.size(); int m=x[0].size(); for(int i=0;i<n;i++){ vector<pll> v; for(int j=r=0;j<n;j++){ a[j]=(i==j); if(a[j]) continue; r+=x[j][m-1]-x[i][0]; v.append({x[j][m-1]-x[i][0]-x[i][0]+x[j][0],j}); } sort(all(v)); for(int j=0;j<n/2-1;j++){ r-=v[j].ff; a[v[j].ss]=1; } for(int j=0;j<n;j++){ if(a[j]){ u.append(0); if(x[j][0]>x[i][0]) r=0; } else{ u.append(m-1); if(x[j][m-1]<x[i][0]) r=0; } } ans=max(ans,{r,u}); u.clear(); } vector<vector<int>> v; for(int i=0;i<n;i++){ for(int j=0;j<m;j++) u.append(-1); v.append(u); u.clear(); } for(int i=0;i<n;i++) v[i][ans.ss[i]]=0; allocate_tickets(v); return ans.ff; }
#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...