답안 #954801

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
954801 2024-03-28T14:52:44 Z IUA_Hasin 메기 농장 (IOI22_fish) C++17
0 / 100
91 ms 23640 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<int> v0[N];
                        vector<int> v1[N];
                        for(int i=0; i<N; i++){
                          vis0[i] = 0;
                          vis1[i] = 0;
                        }
                        // cout << " first loop" << endl;
                        
                        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){
                            if(vis0[i]==1){
                              ll c = v0[i][0];
                              // cout << "v0" << " " << c << endl;
                              l = l+c;
                            }

                            if(vis1[i]==1){
                              ll c = v1[i][0];
                              // cout << "v1" << " " << c << endl;
                              r = r-c;
                            }

                            ll temp = l+r;
                            ans = max(temp, ans);
                          }
                        }
                        // cout << sum0 << " " << sum1 << endl;
                        // ans = max(ans, sum1);
                        ll result = ans;
                        return result;


  // return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 11736 KB Output is correct
2 Correct 32 ms 13904 KB Output is correct
3 Correct 4 ms 6488 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 87 ms 23124 KB Output is correct
6 Incorrect 91 ms 23640 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 52 ms 17744 KB Output is correct
3 Correct 66 ms 21068 KB Output is correct
4 Correct 27 ms 11856 KB Output is correct
5 Correct 33 ms 13904 KB Output is correct
6 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6488 KB Output is correct
2 Correct 4 ms 6488 KB Output is correct
3 Incorrect 15 ms 8540 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '4044', found: '6066'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 6488 KB Output is correct
2 Correct 4 ms 6488 KB Output is correct
3 Incorrect 15 ms 8540 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '26722445760742'
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 38 ms 11736 KB Output is correct
2 Correct 32 ms 13904 KB Output is correct
3 Correct 4 ms 6488 KB Output is correct
4 Correct 4 ms 6492 KB Output is correct
5 Correct 87 ms 23124 KB Output is correct
6 Incorrect 91 ms 23640 KB 1st lines differ - on the 1st token, expected: '300000000000000', found: '299997000000000'
7 Halted 0 ms 0 KB -