Submission #745740

# Submission time Handle Problem Language Result Execution time Memory
745740 2023-05-21T06:07:21 Z inventiontime Catfish Farm (IOI22_fish) C++17
9 / 100
29 ms 8116 KB
#include "fish.h"

#include <bits/stdc++.h>
using namespace std;

#define pb push_back
#define re resize
#define ff first
#define ss second

#define all(x) (x).begin(), (x).end()
#define all1(x) (x).begin()+1, (x).end()
#define loop(i, n) for(int i = 0; i < n; i++)
#define loop1(i, n) for(int i = 1; i <= n; i++)

#define print(x) cout << #x << ": " << x << endl << flush

template<class T> bool ckmin(T&a, T b) { bool B = a > b; a = min(a, b); return B; }
template<class T> bool ckmax(T&a, T b) { bool B = a < b; a = max(a, b); return B; }

typedef long long ll;
typedef vector<int> vi;

const int inf = 1e17;

ll max_weights(int n, int m, vi x, vi y, vi w) {

    ll fish[n+1];
    loop(i, n+1) fish[i] = 0;
    loop(i, m)
        fish[x[i]+1] = w[i];
    
    ll dp[n+1][2][2];
    dp[0][0][0] = -inf;
    dp[0][0][1] = 0;
    dp[0][1][0] = -inf;
    dp[0][1][1] = 0;

    loop1(i, n) {
        dp[i][0][0] = max(dp[i-1][0][0], dp[i-1][1][0]);
        dp[i][0][1] = max(dp[i-1][1][0], dp[i-1][0][0]) + fish[i];
        dp[i][1][0] = max(dp[i-1][0][1], dp[i-1][1][1]);
        dp[i][1][1] = dp[i-1][0][1] + fish[i];
    }
    
    return max({dp[n][0][0], dp[n][0][1], dp[n][1][0]});

}

Compilation message

fish.cpp:24:17: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+17' to '2147483647' [-Woverflow]
   24 | const int inf = 1e17;
      |                 ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 5728 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 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 3 ms 4180 KB Output is correct
2 Correct 3 ms 4140 KB Output is correct
3 Correct 18 ms 5236 KB Output is correct
4 Correct 12 ms 5588 KB Output is correct
5 Correct 29 ms 8076 KB Output is correct
6 Correct 25 ms 7480 KB Output is correct
7 Correct 27 ms 7992 KB Output is correct
8 Correct 27 ms 8116 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 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 212 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 212 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 3 ms 4180 KB Output is correct
2 Correct 3 ms 4140 KB Output is correct
3 Correct 18 ms 5236 KB Output is correct
4 Correct 12 ms 5588 KB Output is correct
5 Correct 29 ms 8076 KB Output is correct
6 Correct 25 ms 7480 KB Output is correct
7 Correct 27 ms 7992 KB Output is correct
8 Correct 27 ms 8116 KB Output is correct
9 Incorrect 28 ms 7856 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 5728 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -