Submission #1079194

# Submission time Handle Problem Language Result Execution time Memory
1079194 2024-08-28T11:52:44 Z vjudge1 Catfish Farm (IOI22_fish) C++17
3 / 100
70 ms 13648 KB
#include "fish.h"

#include <bits/stdc++.h>

#define fore(i, l, r) for(int i=int(l); i<int(r); i++)

using namespace std;

long long max_weights(int N, int M, std::vector<int> X, std::vector<int> Y,
                      std::vector<int> W) {
  long long ok=1,ok1=1;
    fore(i,0,M) {
        if(X[i] % 2)
            ok=0;
        if(X[i] > 1)
            ok1=0;
    }
    long long ans=0;
    if(ok)
        fore(i,0,M)
            ans+=W[i];
    else if(ok1) {
        long long sum1=0,sum2=0;
        fore(i,0,M) {
            if(X[i] == 0)
                sum1+=W[i];
            else
                sum2+=W[i];
        }
        ans = max(sum1,sum2);
    } else {
        long long dp[N+5];
        memset(dp,0,sizeof dp);
        long long grid[N+5];
        memset(grid,0,sizeof grid);
        fore(i,0,M)
            grid[X[i]] = W[i];
        fore(i,0,N) {
            dp[i] = grid[i];
            if(i > 1)
                dp[i] += dp[i-2];
            if(i)
                dp[i] = max(dp[i],dp[i-1]);
        }
        ans = dp[N-1];
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 14 ms 3672 KB Output is correct
2 Correct 28 ms 4436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 65 ms 13140 KB Output is correct
6 Correct 70 ms 13648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 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 1 ms 344 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Incorrect 11 ms 4012 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 1884 KB Output is correct
3 Incorrect 11 ms 4012 KB 1st lines differ - on the 1st token, expected: '21261825233649', found: '16359027219341'
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 3672 KB Output is correct
2 Correct 28 ms 4436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 65 ms 13140 KB Output is correct
6 Correct 70 ms 13648 KB Output is correct
7 Incorrect 1 ms 344 KB 1st lines differ - on the 1st token, expected: '2', found: '1'
8 Halted 0 ms 0 KB -