제출 #45224

#제출 시각아이디문제언어결과실행 시간메모리
45224sorry_Benq캥거루 (CEOI16_kangaroo)C++17
36 / 100
2068 ms1568 KiB
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; int DPplusfirst[205][205]; int DPplussecond[205][205]; int DPminusfirst[205][205]; int DPminussecond[205][205]; void cpy(){ for (int i = 0; i < 205; i++){ for (int j = 0; j < 205; j++){ DPplusfirst[i][j] = DPplussecond[i][j]; DPminusfirst[i][j] = DPminussecond[i][j]; } } } int main(){ int N, cs, cf; cin >> N >> cs >> cf; DPplussecond[1][2] = 1LL; DPminussecond[2][1] = 1LL; for (int i = 3; i <= N; i++){ cpy(); for (int k = 1; k <= i; k++){ for (int j = 1; j <= i; j++){ if (k == j) continue; DPplussecond[j][k] = 0LL; DPminussecond[j][k] = 0LL; int eps = (k > j); for (int l = 1; l <= j - 1; l++){ DPminussecond[j][k] += DPplusfirst[l][k - eps]; DPminussecond[j][k] %= MOD; } for (int l = j + 1; l <= i; l++){ DPplussecond[j][k] += DPminusfirst[l - 1][k - eps]; DPplussecond[j][k] %= MOD; } } } } cout << (DPplussecond[cs][cf] + DPminussecond[cs][cf]) % MOD << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...