Submission #255667

#TimeUsernameProblemLanguageResultExecution timeMemory
255667blacktulipZapina (COCI20_zapina)C++17
110 / 110
405 ms2936 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lo; typedef pair< lo,lo > PII; #define fi first #define se second #define mp make_pair #define endl "\n" #define pb push_back #define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define FOR for(int i=1;i<=n;i++) #define mid ((start+end)/2) #define ort ((bas+son)/2) const lo inf = 1000000000000000000; const lo KOK = 100000; const lo LOG = 30; const lo li = 353; const lo mod = 1000000007; int n,m,b[li],a[li],k,t,comb[li][li],dp[li][li][4]; int cev; string s; vector<int> v; inline int add(int x,int y){ if(x+y>=mod)return x+y-mod; return x+y; } inline int mul(int x,int y){ return (x%mod)*(y%mod)%mod; } inline int f(int sira,int how,int flag){ int cevv=0; if(how<0)return 0; if(how==0)return flag; if(sira>n){ return 0; } if(~dp[sira][how][flag])return dp[sira][how][flag]; for(int i=0;i<=how;i++){ cevv=add(cevv,mul(comb[how][i],f(sira+1,how-i,flag|(sira==i?1:0)))); } return dp[sira][how][flag]=cevv; } int main(void){ memset(dp,-1,sizeof(dp)); scanf("%d",&n); comb[0][0]=1; FOR{ for(int j=0;j<=n;j++){ comb[i][j]=comb[i-1][j]; if(j)comb[i][j]=add(comb[i][j],comb[i-1][j-1]); } } printf("%d\n",f(1,n,0)); return 0; }

Compilation message (stderr)

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