(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

제출 #26393

#제출 시각아이디문제언어결과실행 시간메모리
26393WhipppedCream캥거루 (CEOI16_kangaroo)C++14
100 / 100
99 ms17724 KiB
#include <bits/stdc++.h> using namespace std; #define X first #define Y second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef vector<int> vi; typedef vector< ii > vii; typedef long long L; typedef vector< L > vL; typedef vector< vL > vvL; typedef vector< vi > vvi; typedef vector< vii > vvii; const int inf = 1e9; const L inf8 = 1e18; const int md = 1e9 + 7; int s, e; int dp[2005][2005]; void add(int &a, int b) { a += b; if(a>= md) a -= md; } int mul(int a, int b) { return (1LL*a*b)%md; } int cc(int i, int j) { if(i>= s) j--; if(i>= e) j--; return j; } int main() { int n; scanf("%d %d %d", &n, &s, &e); dp[0][0] = 1; int ans = 0; for(int i = 1; i<= n; i++) { for(int j = 0; j<= n; j++) { int v = dp[i-1][j]; int f = cc(i-1, j); if(i == s) { add(dp[i][j], mul(f, v)); add(dp[i][j+1], v); if(i == n && j == 1) add(ans, v); } else if(i == e) { add(dp[i][j], mul(f, v)); add(dp[i][j+1], v); if(i == n && j == 1) add(ans, v); } else { add(dp[i][j+1], v); if(j && i-1>= s) add(dp[i][j-1], mul(f, v)); if(j && i-1>= e) add(dp[i][j-1], mul(f, v)); if(j) add(dp[i][j-1], mul(f, mul(f-1, v))); if(i == n && j == 2) add(ans, v); } } } printf("%d\n", ans); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:37:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int n; scanf("%d %d %d", &n, &s, &e);
                                      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...