답안 #724353

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724353 2023-04-15T06:26:47 Z raul2008487 메기 농장 (IOI22_fish) C++17
0 / 100
84 ms 7268 KB
#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) {
    long long i,ans=0;
    if(N==2){
        long long ans1=0,ans2=0;
        for(i=0;i<W.size();i++){
            if(X[i]==1){
                ans1+=W[i];
            }
            else{
                ans2+=W[i];
            }
        }
        if(ans1>ans2){
            return ans1;
        }
        else{
            return ans2;
        }
    }
    else{
        long long cur1=0,cur2=0,w1=0;
        for(i=0;i<W.size();i++){
            if(X[i]==1){
                w1+=W[i];
            }
        }
        long long cx=0;
        for(i=0;i<W.size();i++){
            if(X[i]==0){
                cur1+=W[i];
            }
            else{
                cur2+=W[i];
            }
            if((cur1-cur2)>cx){
                cx=cur1-cur2;
            }
        }
        return w1+cx;
    }
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:9:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         for(i=0;i<W.size();i++){
      |                 ~^~~~~~~~~
fish.cpp:26:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(i=0;i<W.size();i++){
      |                 ~^~~~~~~~~
fish.cpp:32:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         for(i=0;i<W.size();i++){
      |                 ~^~~~~~~~~
fish.cpp:6:17: warning: unused variable 'ans' [-Wunused-variable]
    6 |     long long i,ans=0;
      |                 ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2132 KB Output is correct
2 Correct 25 ms 2644 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 84 ms 7268 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 41 ms 3988 KB 1st lines differ - on the 1st token, expected: '40604614618209', found: '40621475040444'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '1'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '882019', found: '0'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 2132 KB Output is correct
2 Correct 25 ms 2644 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 84 ms 7268 KB 1st lines differ - on the 1st token, expected: '149814460735479', found: '0'
6 Halted 0 ms 0 KB -