Submission #302997

#TimeUsernameProblemLanguageResultExecution timeMemory
302997ivan24Carnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms768 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; using ll = long long int; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int,int> ii; typedef vector<ii> vii; typedef vector<vii> vvii; #define F first #define S second class Solver{ private: ll k,n,m; vvi x; public: Solver(ll k,vvi x): k(k),x(x){ n = x.size(); m = x[0].size(); } ll solve(){ vi te; for (auto i: x){ te.push_back(i[0]); } sort(te.begin(),te.end()); ll res = 0; for (ll i = 0; te.size() > i*2; i++){ res += te[n-i-1]-te[i]; } allocate_tickets(vvi(n,vi{0})); return res; } }; long long find_maximum(int k, std::vector<std::vector<int>> x) { Solver mySolver(k,x); return mySolver.solve(); }

Compilation message (stderr)

tickets.cpp: In member function 'll Solver::solve()':
tickets.cpp:29:34: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   29 |         for (ll i = 0; te.size() > i*2; i++){
      |                        ~~~~~~~~~~^~~~~
#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...