Submission #850351

# Submission time Handle Problem Language Result Execution time Memory
850351 2023-09-16T12:28:01 Z AliHasanli Catfish Farm (IOI22_fish) C++17
3 / 100
58 ms 7248 KB
#include "fish.h"
#include <vector>
using namespace std;
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W)
{
    if(N==1)
        return 0;
    bool check=true;
    int maxX=0;
    for(int i:X)
        maxX=max(maxX,X[i]);
    for(int i:X)
        if(i%2)
        {
            check=false;
            break;
        }
    long long ans=0;
    if(check)
    {
        for(int i=0;i<W.size();i++)
        ans+=W[i];
        return ans;
    }
    else if(maxX==0)
    {
        for(int i=0;i<W.size();i++)
        ans+=W[i];
        return ans;
    }
    else if(maxX==1)
    {
        long long ansX0=0,ansX1=0;
        for(int i=0;i<X.size();i++)
            if(X[i]==0)
                ansX0+=W[i];
            else 
                ansX1+=W[i];
        return max(ansX0,ansX1);
    }
    return 0;
}

Compilation message

fish.cpp: In function 'long long int max_weights(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
fish.cpp:21:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |         for(int i=0;i<W.size();i++)
      |                     ~^~~~~~~~~
fish.cpp:27:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |         for(int i=0;i<W.size();i++)
      |                     ~^~~~~~~~~
fish.cpp:34:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         for(int i=0;i<X.size();i++)
      |                     ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2136 KB Output is correct
2 Correct 23 ms 2640 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 57 ms 7248 KB Output is correct
6 Correct 58 ms 7248 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 1 ms 344 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '3', found: '0'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Runtime error 1 ms 344 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2136 KB Output is correct
2 Correct 23 ms 2640 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 57 ms 7248 KB Output is correct
6 Correct 58 ms 7248 KB Output is correct
7 Incorrect 0 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -