結果
| 問題 |
No.612 Move on grid
|
| コンテスト | |
| ユーザー |
pin
|
| 提出日時 | 2017-12-12 19:02:34 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,561 bytes |
| コンパイル時間 | 756 ms |
| コンパイル使用メモリ | 84,232 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-14 06:20:02 |
| 合計ジャッジ時間 | 7,650 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 3 |
| other | AC * 1 WA * 16 |
ソースコード
#include <iostream>
#include <iomanip>
#include <cstring>
#include <algorithm>
#include <math.h>
#include <queue>
#include <functional>
#include <map>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
int T, a, b, c, d, e;
ll combi[600][600];
ll p[600];
void combination(){
combi[0][0] = combi[1][2] = 1;
for (int i = 1; i <= 500; i++){
combi[i][0] = combi[i][i] = 1;
}
for (int i = 2; i <= 500; i++){
for (int j = 1; j < i; j++){
combi[i][j] = combi[i - 1][j - 1] + combi[i - 1][j];
}
}
return;
}
void power(){
p[0] = 1;
for (int i = 1; i <= 500; i++){
p[i] = p[i - 1] * 2;
p[i] %= MOD;
}
}
int main(void){
cin >> T >> a >> b >> c >> d >> e;
combination();
power();
ll ans = 0;
for (int x = -T; x <= T; x++){
for (int y = abs(x) - T; y <= T - abs(x); y++){
for (int z = abs(x) + abs(y) - T; z <= T - abs(x) - abs(y); z++){
if (d <= a*x + b*y + c*z && a*x + b*y + c*z <= e){
int n = T - abs(x) - abs(y) - abs(z);
if (n % 2 == 0){
ll a = combi[T][abs(x)] * combi[T - abs(x)][abs(y)] * combi[T - abs(x) - abs(y)][abs(z)];
a %= MOD;
a *= p[n / 2];
a %= MOD;
ans += a;
ans %= MOD;
}
}
}
}
}
cout << ans << endl;
}
pin