Submission #300165

#TimeUsernameProblemLanguageResultExecution timeMemory
300165model_codeCarnival Tickets (IOI20_tickets)C++17
27 / 100
1354 ms192376 KiB
// huajun-scam #include "tickets.h" #include<bits/stdc++.h> using namespace std; typedef long long int ll; vector<set<pair<ll,ll> > > se; int cur[1505]; long long find_maximum(int k, vector<vector<int>> d) { ll c = d.size(); ll s = d[0].size(); ll sum =0 ,a,b,x,maxn,minx,y,z; vector<vector<int>> answer; for (int i = 0; i < c; i++) { vector<int> row; for(int j=0;j<s;j++)row.push_back(-1); answer.push_back(row); } ll i,j; for(i=0;i<c;i++){ set<pair<ll,ll> > temp; for(j=0;j<s;j++){ temp.insert(make_pair(d[i][j],j)); } se.push_back(temp); } for(i=0;i<k;i++){ vector<tuple<ll,int,int> > v; y = se[0].size(); for(j=0;j<c;j++){ auto it = *se[j].begin(); auto it2 = *(--se[j].end()); cur[j] = it2.second; sum+=it2.first; v.push_back(make_tuple(it.first+it2.first,j,it.second)); } sort(v.begin(),v.end()); for(j=0;j<c/2;j++){ tie(a,b,x) = v[j]; sum-=a; se[b].erase(se[b].begin()); cur[b] = x; } for(j=0;j<c;j++)answer[j][cur[j]] = i; for(j=0;j<c;j++){ if(se[j].size()==y){ se[j].erase(--se[j].end()); } } } allocate_tickets(answer); return sum; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:45:28: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   45 |             if(se[j].size()==y){
      |                ~~~~~~~~~~~~^~~
tickets.cpp:11:22: warning: unused variable 'maxn' [-Wunused-variable]
   11 |     ll sum =0 ,a,b,x,maxn,minx,y,z;
      |                      ^~~~
tickets.cpp:11:27: warning: unused variable 'minx' [-Wunused-variable]
   11 |     ll sum =0 ,a,b,x,maxn,minx,y,z;
      |                           ^~~~
tickets.cpp:11:34: warning: unused variable 'z' [-Wunused-variable]
   11 |     ll sum =0 ,a,b,x,maxn,minx,y,z;
      |                                  ^
#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...