QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#253530 | #6558. Allergen Testing | Nicolas125841 | WA | 2ms | 3680kb | C++17 | 1.6kb | 2023-11-17 07:26:17 | 2023-11-17 07:26:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
int main() {
cin.tie(0)->sync_with_stdio(0);
const int maxn = 60;
ll C[maxn + 1][maxn + 1];
C[0][0] = 1;
for (int n = 1; n <= maxn; ++n) {
C[n][0] = C[n][n] = 1;
for (int k = 1; k < n; ++k)
C[n][k] = C[n - 1][k - 1] + C[n - 1][k];
}
vector<vector<ll>> dp(60, vector<ll>(1000, 0));
for(int i = 0; i < 1000; i++)
dp[0][i] = 1;
for(int i = 1; i < 60; i++){
dp[i][0] = 1;
for(int j = 1; j < 1000; j++)
for(int k = 0; k <= i; k++)
dp[i][j] += C[i][k] * dp[i - k][j - 1];
}
int t;
cin >> t;
while(t--){
ll n, d;
cin >> n >> d;
cout << dp[3][500] << "\n";
if(d < 1000){
for(int i = 0; i < 60; i++){
if(dp[i][d] >= n){
cout << i << "\n";
break;
}
}
}else{
if(1 >= n){
cout << "0\n";
}else if(d + 1 >= n){
cout << "1\n";
}else if((d + 1) * (d + 1)){
cout << "2\n";
}else if(d + 1 + 3 * d * (d + 1) / 2 + d * (2 * d + 1) * (d + 1) / 2){
cout << "3\n";
}else{
cout << "4\n";
}
}
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3680kb
input:
1 4 1
output:
125751501 2
result:
wrong answer 1st lines differ - expected: '2', found: '125751501'