Submission #532796

#TimeUsernameProblemLanguageResultExecution timeMemory
532796aryan12Carnival Tickets (IOI20_tickets)C++17
11 / 100
2 ms716 KiB
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; long long find_maximum(int k, std::vector<std::vector<int> > x) { long long K = k; vector<vector<long long> > input; for(long long i = 0; i < x.size(); i++) { vector<long long> row; for(long long j = 0; j < x[0].size(); j++) { row.push_back(x[i][j]); } input.push_back(row); } long long n = x.size(); long long m = x[0].size(); vector<vector<int> > answer(n, vector<int> (m, -1)); vector<long long> kekw; for(long long i = 0; i < n; i++) { for(long long j = 0; j < m; j++) { answer[i][j] = 0; kekw.push_back(input[i][j]); } } sort(kekw.begin(), kekw.end()); long long ans = 0; long long lmao = kekw[n / 2]; for(long long i = 0; i < n; i++) { ans += abs(lmao - kekw[i]); } allocate_tickets(answer); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:9:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for(long long i = 0; i < x.size(); i++) {
      |                       ~~^~~~~~~~~~
tickets.cpp:11:26: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |   for(long long j = 0; j < x[0].size(); j++) {
      |                        ~~^~~~~~~~~~~~~
tickets.cpp:7:12: warning: unused variable 'K' [-Wunused-variable]
    7 |  long long K = k;
      |            ^
#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...