답안 #629066

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

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll ps1[100005], ps2[100005];

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++) {
		if (X[i] == 0) ps1[Y[i]] += W[i];
		else ps2[Y[i]] += W[i];
	}
	for (int i = 1; i < N; i++) ps1[i] += ps1[i-1];
	for (int i = N-1; i >= 0; i--) ps2[i] += ps2[i+1];
	ll ans = ps[0];
	for (int i = 0; i < N; i++) ans = max(ans,ps1[i] + ps2[i+1]);
	return ans;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:16:11: error: 'ps' was not declared in this scope; did you mean 'ps2'?
   16 |  ll ans = ps[0];
      |           ^~
      |           ps2