제출 #836717

#제출 시각아이디문제언어결과실행 시간메모리
836717Supersonic메기 농장 (IOI22_fish)C++17
9 / 100
74 ms10776 KiB
#include "fish.h" #include <bits/stdc++.h> using namespace std; long long max_weights(int n, int m, std::vector<int> x, std::vector<int> y, std::vector<int> w) { bool s1=1,s2=1; for(auto i:x){if(i%2==1)s1=0;if(i>=2)s2=0;} if(s1){ long long t=0; for(auto i:w)t+=i; return t; } vector<pair<int,int>> a[n]; int sa0[n];int sa1[n]; for(int i=0;i<n;i++)sa0[i]=sa1[i]=0; for(int i=0;i<m;i++){ a[x[i]].push_back({y[i],w[i]}); if(x[i]==0)sa0[y[i]]=w[i]; if(x[i]==1)sa1[y[i]]=w[i]; } if(s2){ if(n==2){ long long at=0,bt=0; for(auto i:a[0])at+=i.second; for(auto i:a[1])bt+=i.second; return max(at,bt); } long long t=0; for(auto i:a[1])t+=i.second; long long ai=0,bi=t; for(int i=0;i<n;i++){ ai+=sa0[i];bi-=sa1[i]; t=max(t,ai+bi); } return t; } return 0; }
#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...