Submission #952703

#TimeUsernameProblemLanguageResultExecution timeMemory
952703woodAsceticism (JOI18_asceticism)C++17
4 / 100
0 ms460 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> p32; 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 int n,k; cin>>n>>k; int 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:28:26: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |     for (size_t i = 1; i < n; i++)
      |                        ~~^~~
asceticism.cpp:30:30: warning: comparison of integer expressions of different signedness: 'size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |         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...