Submission #579321

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5793212022-06-18 20:43:45AugustinasJucasCarnival Tickets (IOI20_tickets)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "tickets.h"
using namespace std;
vector<vector<int> > mas, ans;
vector<vector<pair<int, int> > > maz, did, pos;
long long check() {
vector<vector<int> > vec(m);
for(int i = 0; i < n; i++) {
for(int j = 0; j < m; j++) {
if(ans[i][j] == -1) continue;
vec[ans[i][j]].push_back(mas[i][j]);
}
}
long long ret = 0;
for(int i = 0; i < k; i++) {
sort(vec[i].begin(), vec[i].end());
for(int j = 0; j < vec[i].size(); j++) {
if(j < vec[i].size() / 2) {
ret -= vec[i][j];
}else {
ret += vec[i][j];
}
}
}
return ret;
}
/*
2 3 3
1 2 3
3 1 4
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

tickets.cpp: In function 'long long int check()':
tickets.cpp:7:30: error: 'm' was not declared in this scope; did you mean 'tm'?
    7 |     vector<vector<int> > vec(m);
      |                              ^
      |                              tm
tickets.cpp:8:24: error: 'n' was not declared in this scope
    8 |     for(int i = 0; i < n; i++) {
      |                        ^
tickets.cpp:15:24: error: 'k' was not declared in this scope
   15 |     for(int i = 0; i < k; i++) {
      |                        ^
tickets.cpp:17:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for(int j = 0; j < vec[i].size(); j++) {
      |                        ~~^~~~~~~~~~~~~~~
tickets.cpp:18:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |             if(j < vec[i].size() / 2) {
      |                ~~^~~~~~~~~~~~~~~~~~~
tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:83:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   83 |             if(i1 == did[i].size()) {
      |                ~~~^~~~~~~~~~~~~~~~