답안 #623915

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
623915 2022-08-07T00:35:35 Z ollel 비스킷 담기 (IOI20_biscuits) C++17
33 / 100
867 ms 2097152 KB
using namespace std;
#include <bits/stdc++.h>

#include "biscuits.h"

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long long ll;
typedef vector<bool> vb;
typedef pair<int,int> pii;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back


ll count_tastiness(ll x, vector<ll> a) {
	int k = a.size() + 100;
	rep(i,0,k) a.pb(0);

	rep(i,0,k-1) {
		if (a[i] <= x) continue;

		a[i + 1] += (a[i] - x) / 2;
		a[i] = x + ((a[i] - x) & 1);
	}

	vector<vector<ll>> dp(k, vector<ll>(2*x+6, 0));
	dp[0][a[0]] = 1;
	if (a[0] >= x) dp[0][a[0] - x] = 1;

	rep(i,0,k-1) rep(j,0,2*x+6) {
		dp[i+1][a[i+1] + j/2] += dp[i][j];
		if (a[i+1] + j/2 >= x) dp[i+1][a[i+1] + j/2 - x] += dp[i][j];
	}

	ll ans = 0;
	rep(j,0,2*x+6) ans += dp[k-1][j];

	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 3 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 304 KB Output is correct
4 Correct 1 ms 216 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 308 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 97 ms 25164 KB Output is correct
2 Correct 55 ms 14656 KB Output is correct
3 Correct 59 ms 15948 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 304 KB Output is correct
8 Correct 218 ms 26068 KB Output is correct
9 Correct 151 ms 16600 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 652 KB Output is correct
12 Correct 28 ms 3756 KB Output is correct
13 Correct 220 ms 25428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 867 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Runtime error 3 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -