제출 #769129

#제출 시각아이디문제언어결과실행 시간메모리
769129jack715메기 농장 (IOI22_fish)C++17
0 / 100
34 ms3800 KiB
#include "fish.h" #include <vector> #include <iostream> // #include <bits/stdc++.h> #include <algorithm> void start() { //1 call } using namespace std; long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { long long ans = 0, now = 0, a = 0, b = 0; vector<pair<int, pair<int, int> > > nums; for (int i = 0; i < M; i++) { nums.push_back({Y[i], {X[i], W[i]}}); if (X[i] == 1) now += W[i], b += W[i]; else a += W[i]; } if (N == 2) return max(a, b); sort(nums.begin(), nums.end()); for (int i = 0; i < M; i++) { cout << nums[i].first << ' ' << nums[i].second.first << '\n'; if (i == 0 || nums[i].first != nums[i-1].first) ans = max(ans, now); if (nums[i].second.first == 0) now += nums[i].second.second; else now -= nums[i].second.second; } ans = max(ans, now); 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...