Submission #955001

#TimeUsernameProblemLanguageResultExecution timeMemory
955001IUA_HasinCatfish Farm (IOI22_fish)C++17
6 / 100
88 ms25176 KiB
#include <bits/stdc++.h> #define endl "\n" #define finp for(int i=0; i<n; i++) #define fknp for(int k=0; k<n; k++) #define yeap cout<<"YES"<<endl #define nope cout<<"NO"<<endl #define inpintn int n; cin>>n #define inpintarrn int arr[n]; for(int i=0; i<n; i++){cin>>arr[i];} #define inpllarrn long long arr[n]; for(int i=0; i<n; i++){cin>>arr[i];} #define ll long long using namespace std; #include "fish.h" #include <vector> long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y, std::vector<int> W) { ll vis0[N]; ll vis1[N]; ll sum0 = 0; ll sum1 = 0; vector<ll> v0[N]; vector<ll> v1[N]; for(int i=0; i<N; i++){ vis0[i] = 0; vis1[i] = 0; } for(int i=0; i<M; i++){ ll a = Y[i]; ll b = W[i]; if(X[i]==0){ vis0[a] = 1; sum0 = sum0+b; v0[a].push_back(b); } else { vis1[a] = 1; sum1 = sum1+b; v1[a].push_back(b); } } if(N==2){ ll ans = max(sum0, sum1); return ans; } else { ll ans = sum1; ll l = 0; ll r = sum1; for(int i=0; i<N; i++){ if(i<N-1){ if(vis0[i]==1){ ll c = v0[i][0]; l = l+c; } if(vis1[i]==1){ ll c = v1[i][0]; r = r-c; } ll temp = l+r; ans = max(temp, ans); } else { ll temp = sum0; ans = max(temp, ans); } } return ans; } // ll ans = sum1; // ll l = 0; // ll r = sum1; // for(int i=0; i<N; i++){ // if(i<N-1){ // if(vis0[i]==1){ // ll c = v0[i][0]; // l = l+c; // } // if(vis1[i]==1){ // ll c = v1[i][0]; // r = r-c; // } // ll temp = l+r; // ans = max(temp, ans); // } else { // ll temp = sum0; // ans = max(temp, ans); // } // } // return ans; // 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...