Submission #657496

# Submission time Handle Problem Language Result Execution time Memory
657496 2022-11-10T01:53:38 Z sentheta Catfish Farm (IOI22_fish) C++17
0 / 100
32 ms 13640 KB
#include "fish.h"
// author : sentheta aka vanwij
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cassert>
#include<random>
#include<chrono>
#include<cmath>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<stack>
#include<map>
#include<set>
using namespace std;

#define Int long long
#define V vector
#define pii pair<int,int>
#define ff first
#define ss second

#define rand() (uniform_int_distribution<int>(0,1<<30)(rng))
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

#define pow2(x) (1LL<<(x))
#define msb(x) (63-__builtin_clzll(x))
#define bitcnt(x) (__builtin_popcountll(x))

#define nl '\n'
#define _ << ' ' <<
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define dbg(x) if(1) cout << "?" << #x << " : " << (x) << endl << flush;

const Int N = 2e5+5;

Int n, m;
V<Int> x, y, w;

Int c[N];
Int dp[N][2][2];

Int max_weights(int _n,int _m,V<int> _x,V<int> _y,V<int> _w){
	n = _n; m = _m;
	x = V<Int>(all(_x)); y = V<Int>(all(_y)); w = V<Int>(all(_w));

	rep(i,0,m){
		c[x[i]] = w[i];
	}

	rep(i,1,N){
		rep(p,0,2) rep(q,0,2) rep(r,0,2){
			Int cost = dp[i-1][p][q];
			if(!p && !q && r){
				cost += c[i-1];
			}
			if(q && !r){
				cost += c[i];
			}

			dp[i][q][r] = max(dp[i][q][r], cost);
		}
	}

	Int ans = 0;
	rep(p,0,2) rep(q,0,2){
		ans = max(ans, dp[n][p][q]);
	}
	return ans;




	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 10324 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 5 ms 6484 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 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 19 ms 9800 KB Output is correct
4 Correct 16 ms 9340 KB Output is correct
5 Incorrect 32 ms 13640 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 6484 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 5 ms 6484 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 5 ms 6484 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 5 ms 6484 KB Output is correct
2 Correct 6 ms 6484 KB Output is correct
3 Correct 19 ms 9800 KB Output is correct
4 Correct 16 ms 9340 KB Output is correct
5 Incorrect 32 ms 13640 KB 1st lines differ - on the 1st token, expected: '1673106170551', found: '1673122841934'
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 10324 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -