Submission #721271

#TimeUsernameProblemLanguageResultExecution timeMemory
721271nihaddhuseynliCarnival Tickets (IOI20_tickets)C++14
0 / 100
1 ms304 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll n1,m1,a[1505][1505]; ll func(ll mid) { ll sum=0; for(int i =0;i<n1;i++) { sum+=abs(a[0][i]-mid); } return sum; } 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]); } } ans=maxx; return 0; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:33:5: warning: variable 'ans' set but not used [-Wunused-but-set-variable]
   33 |  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...