Submission #952706

#TimeUsernameProblemLanguageResultExecution timeMemory
952706woodAsceticism (JOI18_asceticism)C++17
4 / 100
1 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll,ll> p64; #define pb push_back #define eb emplace_back #define fi first #define se second #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL) #define MOD %1000000007 int main() { fast_cin(); #ifndef ONLINE_JUDGE #ifdef _WIN32 freopen("input.in", "r", stdin); freopen("input.out", "w", stdout); #endif #endif ll n,k; cin>>n>>k; ll dp[n][n]; memset(dp[0],0,sizeof dp[0]); dp[0][0] = 1; for (size_t i = 1; i < n; i++) { for (size_t j = 0; j < n; j++) { if(j==0) dp[i][j]=1; else dp[i][j]=((j+1)* dp[i-1][j])MOD+((i-j+1)*dp[i-1][j-1])MOD; } } cout<<dp[n-1][k-1]; return 0; }

Compilation message (stderr)

asceticism.cpp: In function 'int main()':
asceticism.cpp:27:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   27 |     for (size_t i = 1; i < n; i++)
      |                        ~~^~~
asceticism.cpp:29:30: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'll' {aka 'long long int'} [-Wsign-compare]
   29 |         for (size_t j = 0; j < n; j++)
      |                            ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...