Submission #938174

#TimeUsernameProblemLanguageResultExecution timeMemory
938174irmuunCatfish Farm (IOI22_fish)C++17
3 / 100
67 ms8348 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() ll max_weights(int n,int m,vector<int>x,vector<int>y,vector<int>w){ int even=0,X=0,Y=0; for(int i=0;i<m;i++){ X=max(X,x[i]); Y=max(Y,y[i]); if(x[i]%2==0) even++; } if(even==m){ ll ans=0; for(int i=0;i<m;i++){ ans+=w[i]; } return ans; } if(X<=1){ ll ans=0,cur=0; for(int i=0;i<m;i++){ if(x[i]==0){ ans+=w[i]; } else{ cur+=w[i]; } } if(n==2) return max(ans,cur); ll sum[n][2]; memset(sum,0,sizeof sum); for(int i=0;i<m;i++){ sum[y[i]][x[i]]+=w[i]; } for(int i=1;i<n;i++){ sum[i][0]+=sum[i-1][0]; sum[i][1]+=sum[i-1][1]; } ans=max(ans,cur); for(int i=1;i<n;i++){ ans=max(ans,sum[i][0]+sum[n-1][1]-sum[i-1][1]); } return ans; } 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...