Submission #1045283

#TimeUsernameProblemLanguageResultExecution timeMemory
1045283mariaclaraCarnival Tickets (IOI20_tickets)C++17
11 / 100
1 ms860 KiB
#include "tickets.h"
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

ll find_maximum(int k, vector<vector<int>> x) {
	int n = sz(x);
	int m = sz(x[0]);

    vector<int> v;
	vector<vector<int>> ans(n);
    ll r = 0;

    for(int i = 0; i < n; i++) v.pb(x[i][0]), ans[i].pb(0);

    sort(all(v));

    for(int i = 0; i < n; i++)
        if(i < n/2) r -= v[i];
        else r += v[i];

	allocate_tickets(ans);
	return r;
}

Compilation message (stderr)

tickets.cpp: In function 'll find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:27:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   27 |     for(int i = 0; i < n; i++)
      |     ^~~
tickets.cpp:31:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   31 |  allocate_tickets(ans);
      |  ^~~~~~~~~~~~~~~~
tickets.cpp:17:6: warning: unused variable 'm' [-Wunused-variable]
   17 |  int m = sz(x[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...