답안 #634100

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
634100 2022-08-23T19:53:34 Z Jovan26 메기 농장 (IOI22_fish) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
long long max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w){
	long long rez = 0;
	bool s1 = true;
	bool s2 = true;
	ifor(int i=0;i<x.size();i++){
		if(x[i]%2==1) s1 = false;
		if(x[i]>1) s2 = false;
	}
	if(s1)
	for(int i=0;i<w.size();i++) rez+=w[i];
	if(s2){
		long long m1 = 0;
		long long m2 = 0;
		for(int i=0;i<w.size();i++){
			if(x[i]==0) m1+=w[i];
			else m2+=w[i];
		}
		rez=max(m1,m2);
	}
	return rez;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:7:7: error: expected primary-expression before 'int'
    7 |  ifor(int i=0;i<x.size();i++){
      |       ^~~
fish.cpp:7:15: error: 'i' was not declared in this scope
    7 |  ifor(int i=0;i<x.size();i++){
      |               ^
fish.cpp:12:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for(int i=0;i<w.size();i++) rez+=w[i];
      |              ~^~~~~~~~~
fish.cpp:16:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |   for(int i=0;i<w.size();i++){
      |               ~^~~~~~~~~