Submission #1055933

# Submission time Handle Problem Language Result Execution time Memory
1055933 2024-08-13T06:40:50 Z amirhoseinfar1385 Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
    long long sum1=0,sum0=0,res=0,f=0;
    n=N;
    for(int i=0;i<n;i++){
        res+=W[i];
        if(X[i]==0){
            sum0+=W[i];
        }else if(X[i]==1){
            sum1+=W[i];
        }else{
            f=1;
        }
    }
    if(f==0){
        return max(sum1,sum0);
    }
  return res;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:8:5: error: 'n' was not declared in this scope
    8 |     n=N;
      |     ^