제출 #1120080

#제출 시각아이디문제언어결과실행 시간메모리
1120080fyanMobitel (COCI19_mobitel)C++14
13 / 130
2309 ms8500 KiB
#include "bits/stdc++.h" using namespace std; #define all(x) begin(x), end(x) #define sz(x) (int) (x).size() #define i64 long long const int mxn = 305; const int mod = 1e9+7; i64 ksm(int a, int b = mod-2) { i64 res=1, aux=a; for (int i=1; i<=b; i*=2) { if (i&b) res=res*aux%mod; aux=aux*aux%mod; } return res; } i64 ft[2*mxn],ift[2*mxn]; i64 nck(int n, int k) { return ft[n]*ift[k]%mod*ift[n-k]%mod; } int r,c,n,g[mxn][mxn]; map<int,int> dp[mxn*mxn]; signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); ft[0] = ift[0] = 1; for (int i=1; i<2*mxn; i++) { ft[i] = i*ft[i-1]%mod; ift[i] = ksm(ft[i]); } cin>>r>>c>>n; n--; for (int i=0; i<r; i++) { for (int j=0; j<c; j++) { cin>>g[i][j]; } } cin>>r>>c>>n; dp[0][n/g[0][0]]++; for (int i=0; i<r; i++) { for (int j=0; j<c; j++) { if (i<r-1) { for (auto [v,amt] : dp[i*mxn+j]) { if (!v/g[i+1][j]) break; dp[(i+1)*mxn+j][v/g[i+1][j]] += amt; dp[(i+1)*mxn+j][v/g[i+1][j]] %= mod; } } if (j<c-1) { for (auto [v,amt] : dp[i*mxn+j]) { if (!v/g[i][j+1]) break; dp[i*mxn+j+1][v/g[i][j+1]] += amt; dp[i*mxn+j+1][v/g[i][j+1]] %= mod; } } if (i!=r-1 || j!=c-1) dp[i*mxn+j].clear(); } } int cnt = 0; for (auto [v,amt] : dp[(r-1)*mxn+c-1]) { if (v) { cnt += amt; cnt %= mod; } } cnt = (mod+nck(r+c-2,c-1)-cnt)%mod; cout<<cnt; }

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

mobitel.cpp: In function 'int main()':
mobitel.cpp:50:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   50 |     for (auto [v,amt] : dp[i*mxn+j]) {
      |               ^
mobitel.cpp:57:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   57 |     for (auto [v,amt] : dp[i*mxn+j]) {
      |               ^
mobitel.cpp:68:12: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   68 |  for (auto [v,amt] : dp[(r-1)*mxn+c-1]) {
      |            ^
#Verdict Execution timeMemoryGrader output
Fetching results...