Submission #1037270

# Submission time Handle Problem Language Result Execution time Memory
1037270 2024-07-28T12:03:01 Z mindiyak Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "fish.h"
#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cmath>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<int, int> pl;
typedef pair<ld, ld> pd;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<ld> vd;
typedef vector<long long> vl;
typedef vector<vl> vvl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define F0R(i, a) for (int i = 0; i < (a); i++)
#define FORd(i, a, b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i, a) for (int i = (a)-1; i >= 0; i--)
#define trav(a, x) for (auto &a : x)
#define uid(a, b) uniform_int_distribution<int>(a, b)(rng)
#define len(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define F first
#define nl endl
#define S second
#define lb lower_bound
#define ub upper_bound
#define aint(x) x.begin(), x.end()
#define raint(x) x.rbegin(), x.rend()
#define ins insert
const int MOD = 1000000007;
 
long long max_weights(int N, int M, vector<int> X, vector<int> Y, vector<int> W) {
 ll ans = 0;
 vvl dp(5,vl(N+5,0));
 vvl arr(5,vl(N+5,0));
 
 FOR(i,0,M){
    arr[X[i]][Y[i]] = W[i];
 }
 
//  cout << endl;
//  FOR(i,0,N){
//   FOR(j,0,N){
//     cout << arr[i][j] << " ";
//   }
//   cout << endl;
//  }
//  cout <<endl;
 
 FOR(i,0,5){
  FOR(j,-1,N+1){
    ll temp = 0,added = 0;
 
    if(j == -1){
      if(i>0){
        FOR(k,-1,N+1){
          temp = max(temp,dp[i-1][k+1]);
        }
      }
      dp[i][j+1] = temp;
      continue;
    }
 
    FOR(k,0,j+1){
      if(i<N-1)
        added += arr[i+1][k];
      if(i==1)
        added += arr[0][k];
    }
 
    temp = max(temp,added);
 
    if(i == 0){
      dp[i][j+1] = temp;
      continue;
    }
 
    temp = max(temp,added+dp[i-1][0]);
    
    FOR(k,1,N+1){
      if(k-1<j+1){
        added -= arr[i][k-1];
      }
      temp = max(temp,added+dp[i-1][k]);
    }
    dp[i][j+1] = temp;
  }
 }
 
 FOR(i,0,5){
  FOR(j,0,N+1){
    // cout << dp[i][j] << " ";
    ans = max(ans,dp[i][j]);
  }
  // cout << endl;
 }
 
  return ans;
}
Subtask #1

Compilation message

fish.cpp:109:9: error: stray '#' in program
  109 | Subtask #1
      |         ^
fish.cpp:109:1: error: 'Subtask' does not name a type
  109 | Subtask #1
      | ^~~~~~~