제출 #635288

#제출 시각아이디문제언어결과실행 시간메모리
635288gromperen메기 농장 (IOI22_fish)C++17
6 / 100
95 ms8804 KiB
#include "fish.h" #include <bits/stdc++.h> #define ll long long using namespace std; long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) { vector<ll> pre1(N+1); vector<ll> pre2(N+1); for (int i = 0; i < M; ++i) { if (X[i] == 0) pre1[Y[i]] += W[i]; else pre2[Y[i]] += W[i]; } for (int i = 1; i <= N; ++i) { pre1[i] += pre1[i-1]; pre2[i] += pre2[i-1]; } if (N <= 2) { return max(pre1[N], pre2[N]); } ll ans = 0; for (int i = 0; i <=N; ++i) { ll cur = pre1[i] + pre2[N] - pre2[i]; //cerr << cur << endl; ans = max(ans, cur); } ans = max(ans, pre2[N]); return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...