Submission #721310

#TimeUsernameProblemLanguageResultExecution timeMemory
721310nihaddhuseynliCarnival Tickets (IOI20_tickets)C++14
11 / 100
5 ms6740 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll n1,m1,a[1505][1505]; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); 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); ll ans=0,maxx=0; for(int i =0;i<n;i++) { for(int j =0;j<m;j++) { a[i][j]=x[i][j]; maxx=max(maxx,(ll)x[i][j]); } } ll sum=0; sort(x.begin(),x.end()); for(int i=0;i<n/2;i++){ sum+=x[i][0]; } reverse(x.begin(),x.end()); ll sum1=0; for(int i=0;i<n/2;i++){ sum1+=x[i][0]; } return sum1-sum; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:24:5: warning: unused variable 'ans' [-Wunused-variable]
   24 |  ll ans=0,maxx=0;
      |     ^~~
#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...