답안 #1043155

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1043155 2024-08-04T03:14:22 Z ezzzay 메기 농장 (IOI22_fish) C++17
컴파일 오류
0 ms 0 KB
#include "fish.h"
#include<bits/stdc++.h>
using namespace std;
#include <vector>
#define ll long long
const int MN=3e5;
int ps[MN][2];
long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,std::vector<int> W) {
    for(int i=0;i<M;i++){
        ps[Y[i]][X[i]]+=W[i];
    }
    for(int i=1;i<MN;i++){
        ps[i][0]+=ps[i-1][0];
        ps[i][1]+=ps[i-1][1];
    }
    for(int i=0;i<N;i++){
        ans=max(ans,ps[N+5][0]-ps[i][0]+ps[i][1]);
    }
    ans=max(ans,ps[N+5][0]);
    ans=max(ans,ps[N+5][1]);
}

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:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   17 |         ans=max(ans,ps[N+5][0]-ps[i][0]+ps[i][1]);
      |         ^~~
      |         abs
fish.cpp:19:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   19 |     ans=max(ans,ps[N+5][0]);
      |     ^~~
      |     abs
fish.cpp:21:1: warning: no return statement in function returning non-void [-Wreturn-type]
   21 | }
      | ^