제출 #836698

#제출 시각아이디문제언어결과실행 시간메모리
836698SupersonicCatfish Farm (IOI22_fish)C++17
컴파일 에러
0 ms0 KiB
#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) {
  bool s1=1,s2=1;
  for(auto i:x){if(i%2==1)s1=0;if(i>=2)s2=0;}
  if(s1){
    long long t=0;
    for(auto i:w)t+=w;
    return t;
  }
  return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:11:19: error: no match for 'operator+=' (operand types are 'long long int' and 'std::vector<int>')
   11 |     for(auto i:w)t+=w;
      |                  ~^~~
fish.cpp:11:14: warning: unused variable 'i' [-Wunused-variable]
   11 |     for(auto i:w)t+=w;
      |              ^