답안 #625997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
625997 2022-08-11T06:07:25 Z aryan12 메기 농장 (IOI22_fish) C++17
컴파일 오류
0 ms 0 KB
#include "fish.h"

#include <vector>

long long max_weights(int N, int M, std::vector<int> X, 
    std::vector<int> Y, std::vector<int> W) {
    long long ans1 = 0, ans2 = 0;
    for(int i = 0; i < W.size(); i++)
    {
        if(X[i] == 0) ans1 += W[i];
        else ans2 += W[i];
    }
    return max(ans1, ans2); // subtask 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:8:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 |     for(int i = 0; i < W.size(); i++)
      |                    ~~^~~~~~~~~~
fish.cpp:13:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   13 |     return max(ans1, ans2); // subtask 1
      |            ^~~
      |            std::max
In file included from /usr/include/c++/10/vector:60,
                 from fish.h:1,
                 from fish.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: 'std::max' declared here
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~