Submission #654808

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6548082022-11-01 17:01:11t6twotwoCatfish Farm (IOI22_fish)C++17
Compilation error
0 ms0 KiB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
const long long inf = -(1LL << 50);
long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) {
vector p(n, vector<int>(n + 1));
for (int i = 0; i < m; i++) {
p[x[i]][y[i] + 1] = w[i];
}
vector s(n, vector<long long>(n + 2));
for (int i = 0; i < n; i++) {
for (int j = 0; j <= n; j++) {
s[i][j + 1] = s[i][j] + p[i][j];
}
}
auto range_sum = [&](int i, int l, int r) -> long long {
if (i == -1) {
return 0;
}
return s[i][r + 1] - s[i][l + 1];
};
vector<vector<int>> b(n);
for (int i = 0; i < m; i++) {
b[x[i]].push_back(i);
}
vector d(n, vector<int>{-1});
vector<vector<int>> r(n), p(n);
for (int i = 0; i < n; i++) {
sort(b[i].begin(), b[i].end(), [&](int j, int k) {
return y[j] < y[k];
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:27:29: error: redeclaration of 'std::vector<std::vector<int>, std::allocator<std::vector<int> > > p'
   27 |   vector<vector<int>> r(n), p(n);
      |                             ^
fish.cpp:6:10: note: 'std::vector<std::vector<int>, std::allocator<std::vector<int> > > p' previously declared here
    6 |   vector p(n, vector<int>(n + 1));
      |          ^
fish.cpp: In lambda function:
fish.cpp:60:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for (int j = 0; j < p[i].size(); j++) {
      |                     ~~^~~~~~~~~~~~~
fish.cpp: In lambda function:
fish.cpp:73:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   73 |     for (int j = 0; j < p[i].size(); j++) {
      |                     ~~^~~~~~~~~~~~~