답안 #821951

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
821951 2023-08-11T23:49:00 Z YesPy 메기 농장 (IOI22_fish) C++17
9 / 100
41 ms 19940 KB
#include <bits/stdc++.h>
// #include "fish.h"

#define tcT template<class T
#define fastio ios::sync_with_stdio(false);cin.tie(nullptr);
#define ln '\n'
#define nwln cout<<ln;

using namespace std;

tcT> using vr = vector<T>;
using ll = long long;
using vi = vr<int>;
using vl = vr<ll>;
using vvl = vr<vl>;
using vvvl = vr<vvl>;

#define eb emplace_back
#define fri(i,a,b) for(int i=(a); i<(b); ++i)
#define each(x, a) for(auto& x: a)
#define maxs(i, j) (i = max(i, j))

const int MX = (int) 3e5+3;
const int INF = 1001002003;

ll res;
vl val;
vvvl dp;

ll max_weights(int n, int m, vi x, vi y, vi w) {
	dp.assign(n, vvl(2, vl(2, -INF))), res = 0;
	val.assign(n, 0);

	fri(i,0,m) val[x[i]] = w[i];

	dp[0][0][0] = dp[0][1][0] = 0;

	fri(i,0,n-1) {
		maxs(dp[i+1][0][0], dp[i][0][0]);
		maxs(dp[i+1][0][0], dp[i][0][1]);
		// cout<<"dp["<<i+1<<"][0][0] = "<<dp[i+1][0][0]<<ln;

		maxs(dp[i+1][1][0], dp[i][0][0] + val[i]);
		maxs(dp[i+1][1][0], dp[i][0][1]);
		// cout<<"dp["<<i+1<<"][1][0] = "<<dp[i+1][1][0]<<ln;

		maxs(dp[i+1][0][1], dp[i][1][0] + val[i+1]);
		maxs(dp[i+1][0][1], dp[i][1][1] + val[i+1]);
		// cout<<"dp["<<i+1<<"][0][1] = "<<dp[i+1][0][1]<<ln;

		maxs(dp[i+1][1][1], dp[i][1][1]);
		maxs(dp[i+1][1][1], dp[i][1][0]);
		// cout<<"dp["<<i+1<<"][1][1] = "<<dp[i+1][1][1]<<ln;
	}

	fri(i,0,2) {
		fri(j,0,2) maxs(res, dp[n-1][i][j]);
	}

	return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 17492 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 15956 KB Output is correct
2 Correct 15 ms 15948 KB Output is correct
3 Correct 25 ms 16548 KB Output is correct
4 Correct 24 ms 17376 KB Output is correct
5 Correct 37 ms 19940 KB Output is correct
6 Correct 34 ms 19172 KB Output is correct
7 Correct 37 ms 19880 KB Output is correct
8 Correct 39 ms 19764 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 1st lines differ - on the 1st token, expected: '3', found: '2'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 15956 KB Output is correct
2 Correct 15 ms 15948 KB Output is correct
3 Correct 25 ms 16548 KB Output is correct
4 Correct 24 ms 17376 KB Output is correct
5 Correct 37 ms 19940 KB Output is correct
6 Correct 34 ms 19172 KB Output is correct
7 Correct 37 ms 19880 KB Output is correct
8 Correct 39 ms 19764 KB Output is correct
9 Incorrect 41 ms 19528 KB 1st lines differ - on the 1st token, expected: '99999', found: '66666'
10 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 17492 KB 1st lines differ - on the 1st token, expected: '40313272768926', found: '803213453'
2 Halted 0 ms 0 KB -