Submission #954760

# Submission time Handle Problem Language Result Execution time Memory
954760 2024-03-28T13:56:39 Z IUA_Hasin Catfish Farm (IOI22_fish) C++17
0 / 100
92 ms 22352 KB
#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);
                          }
                        }
                        
                        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);
                          }
                        }
                        ans = max(ans, sum1);
                        return ans;


  // return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 29 ms 11344 KB Output is correct
2 Correct 34 ms 13192 KB Output is correct
3 Correct 4 ms 6492 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 92 ms 22352 KB Output is correct
6 Incorrect 92 ms 22180 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 56 ms 16324 KB Output is correct
3 Correct 70 ms 19536 KB Output is correct
4 Correct 27 ms 11348 KB Output is correct
5 Correct 36 ms 13140 KB Output is correct
6 Incorrect 0 ms 432 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 6492 KB Output is correct
2 Correct 4 ms 6492 KB Output is correct
3 Incorrect 17 ms 8712 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 6492 KB Output is correct
2 Correct 4 ms 6492 KB Output is correct
3 Incorrect 17 ms 8712 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 29 ms 11344 KB Output is correct
2 Correct 34 ms 13192 KB Output is correct
3 Correct 4 ms 6492 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 92 ms 22352 KB Output is correct
6 Incorrect 92 ms 22180 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -