Submission #627451

# Submission time Handle Problem Language Result Execution time Memory
627451 2022-08-12T15:13:01 Z Trisanu_Das Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long int

ll max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
  ll pref0[N + 1], pref1[N + 1];
  for (int i = 0; i < M; i++) {
    if (X[i] == 0) pref0[Y[i] + 1] += W[i];
    else pref1[Y[i] + 1] += W[i];
  }
  for (int i = 1; i <= N; i++) {
    pref0[i] += pref0[i - 1]; pref1[i] += pref1[i - 1];
  }
  ll ans1 = 0, ans2 = 0, ans3 = 0;
  for (int i = 0; i <= N; i++) {
    s1 = max(s1, pref1[i]);
    s2 = max(s2, pref0[i]);
    s3 = max(s3, pref1[N] - pref1[i] + pref0[i]);
  }
  if (N == 2) return max(s1, s2);
  else return max(s1, max(s2, s3));
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:17:5: error: 's1' was not declared in this scope; did you mean 'y1'?
   17 |     s1 = max(s1, pref1[i]);
      |     ^~
      |     y1
fish.cpp:18:5: error: 's2' was not declared in this scope
   18 |     s2 = max(s2, pref0[i]);
      |     ^~
fish.cpp:19:5: error: 's3' was not declared in this scope
   19 |     s3 = max(s3, pref1[N] - pref1[i] + pref0[i]);
      |     ^~
fish.cpp:21:26: error: 's1' was not declared in this scope; did you mean 'y1'?
   21 |   if (N == 2) return max(s1, s2);
      |                          ^~
      |                          y1
fish.cpp:21:30: error: 's2' was not declared in this scope; did you mean 'ans2'?
   21 |   if (N == 2) return max(s1, s2);
      |                              ^~
      |                              ans2
fish.cpp:22:19: error: 's1' was not declared in this scope; did you mean 'y1'?
   22 |   else return max(s1, max(s2, s3));
      |                   ^~
      |                   y1
fish.cpp:22:27: error: 's2' was not declared in this scope; did you mean 'ans2'?
   22 |   else return max(s1, max(s2, s3));
      |                           ^~
      |                           ans2
fish.cpp:22:31: error: 's3' was not declared in this scope; did you mean 'ans3'?
   22 |   else return max(s1, max(s2, s3));
      |                               ^~
      |                               ans3
fish.cpp:15:6: warning: unused variable 'ans1' [-Wunused-variable]
   15 |   ll ans1 = 0, ans2 = 0, ans3 = 0;
      |      ^~~~
fish.cpp:15:16: warning: unused variable 'ans2' [-Wunused-variable]
   15 |   ll ans1 = 0, ans2 = 0, ans3 = 0;
      |                ^~~~
fish.cpp:15:26: warning: unused variable 'ans3' [-Wunused-variable]
   15 |   ll ans1 = 0, ans2 = 0, ans3 = 0;
      |                          ^~~~