제출 #946623

#제출 시각아이디문제언어결과실행 시간메모리
946623vjudge1캥거루 (CEOI16_kangaroo)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; using LL = long long; using PII = pair<int, int>; const int N = 4000; const int M = 1e9 + 7; int dp[N][N]; int main() { ios::sync_with_stdio(0); cin.tie(0); int n, cs, cf; cin >> n >> cs >> cf; dp[1][1] = 1; for(int i = 2; i <= n; ++i){ for(int j = 1; j <= i; ++j){ if(i == cs or i == cf) dp[i][j] = dp[i - 1][j] + dp[i - 1][j - 1]; else { dp[i][j] += 1LL*dp[i - 1][j + 1] * j % M ; //merging of two component dp[i][j] += 1LL*dp[i - 1][j - 1] * (j-2 + i < cf + i < cs ) % M; // start of a new component } dp[i][j] %= M; } } cout << dp[n][1]<<"\n"; }

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

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:25:61: warning: comparisons like 'X<=Y<=Z' do not have their mathematical meaning [-Wparentheses]
   25 |                 dp[i][j] += 1LL*dp[i - 1][j - 1] * (j-2 + i < cf + i < cs ) % M; // start of a new component
      |                                                     ~~~~~~~~^~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...