Submission #643627

# Submission time Handle Problem Language Result Execution time Memory
643627 2022-09-22T16:36:15 Z Dextar Catfish Farm (IOI22_fish) C++17
0 / 100
1000 ms 4688 KB
#include <cstdio>
#ifdef DEBUG
    #define D(X) X
#else
    #define D(X)
#endif
#include <bits/stdc++.h>
#define F first
#define S second
#define ll long long
#define pi 3.14159265359
#define pub push_back
#define pob pop_back

using namespace std;

const int INF = 1000 * 1000 * 1000;
const int mod = 1000 * 1000 * 1000 + 7;

ll max_weights(int n, int m, vector<int> x, vector<int> y, vector<int> w)
    {
        ll cnt[n];
        for(int i=0; i<n; i++) {
            cnt[i] = 0;
        }
        for(int i=0; i<m; i++) {
            cnt[x[i]] += w[i];   //cout<<cnt[x[i]]<<endl;
        }
        ll dp[n+1];
        dp[n-1] = dp[n] = 0;
        for(int i=n-2; i>=0; i--) {
            dp[i] = dp[i+2] + cnt[i];   //cout<<dp[i]<<endl;
            for(int j=i+2; j<=n; j++) {
                if(j>=n-1) {
                    dp[i] = max(dp[i], cnt[j-1]);
                } else
                {
                    dp[i] = max(dp[i], cnt[j-1] + dp[j+1]);
                }
            }
        }
        return dp[0];
    }

struct testCase {

    void solve() {

    }
};

/*
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); /*
    //D(freopen("input.txt","r",stdin);)
    //D(freopen("ouput.txt","w",stdout);)
    int t = 1;
    //cin >> t;
    loop:
    while(t--)
    {
        //testCase test;
        //test.solve();
        int n, m;
        cin >> n >> m;
        int x[m], y[m], w[m];
        for(int i=0; i<m; i++) {
            cin >> x[i] >> y[i] >> w[i];
        }
        int64_t res = max_weights(n, m, x, y, w);
        cout << res;
    }  
    return 0;
}  
 */
/*
7 2
*/

Compilation message

fish.cpp:55:60: warning: "/*" within comment [-Wcomment]
   55 |     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); /*
      |
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 4688 KB Time limit exceeded
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 Execution timed out 1089 ms 1748 KB Time limit exceeded
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 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 Execution timed out 1089 ms 1748 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1082 ms 4688 KB Time limit exceeded
2 Halted 0 ms 0 KB -