제출 #637869

#제출 시각아이디문제언어결과실행 시간메모리
637869aris12345678메기 농장 (IOI22_fish)C++17
3 / 100
90 ms8296 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w) { ll first = 0LL, second = 0LL; for(int i = 0; i < m; i++) { if(x[i] == 0) first += 1LL*w[i]; else second += 1LL*w[i]; } if(n == 2) return max(first, second); if(first > second) { int mx = 0; for(int i = 0; i < m; i++) { if(x[i] == 0) mx = max(mx, y[i]); } for(int i = 0; i < m; i++) { if(x[i] == 1 && y[i] > mx) first += 1LL*w[i]; } return first; } else if(first < second) { int mn = n; for(int i = 0; i < m; i++) { if(x[i] == 1) mn = min(mn, y[i]); } for(int i = 0; i < m; i++) { if(x[i] == 0 && y[i] < mn) second += 1LL*w[i]; } return second; } else { int mx = 0, mn = n; for(int i = 0; i < m; i++) { if(x[i] == 0) mx = max(mx, y[i]); else mn = min(mn, y[i]); } for(int i = 0; i < m; i++) { if(x[i] == 1 && y[i] > mx) first += 1LL*w[i]; else if(x[i] == 0 && y[i] < mn) second += 1LL*w[i]; } return max(first, second); } return 0LL; }
#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...