제출 #1123276

#제출 시각아이디문제언어결과실행 시간메모리
1123276qrnTrener (COCI20_trener)C++17
110 / 110
613 ms6172 KiB
#include <bits/stdc++.h> using namespace std; #define SPEED \ ios_base::sync_with_stdio(0); \ cin.tie(NULL); \ cout.tie(NULL); #define pb push_back #define ALL(x) x.begin(), x.end() #define intt long long #define int long long #define endl "\n" const intt mod = 1e9 + 7, base = 31; bool check(const string& s1, const string& s2) { } void solve() { // dp[i][j] -> i-cideyik, j-ci stringi secmisik, L ads intt n, m; cin >> n >> m; vector<vector<string>>g(n + 1, vector<string>(m + 1)); for(int i = 1; i <= n; i++) { for(int j = 1; j <= m; j++) { cin >> g[i][j]; } } vector<vector<intt>>dp(n + 1, vector<intt>(m + 1, 0)); for(int j = 1; j <= m; j++) { dp[1][j] = 1; } for(int i = 2; i <= n; i++) { for(int j = 1; j <= m; j++) { string cur = g[i][j]; string s1 = cur.substr(0, cur.size()-1), s2 = cur.substr(1, cur.size()-1); for(int jp1 = 1; jp1 <= m; jp1++) { if(g[i-1][jp1] == s1 || g[i-1][jp1] == s2) { dp[i][j] += (dp[i-1][jp1]); dp[i][j] %= mod; } } } } // cout << endl; intt ans = 0; // for(int i = 1; i <= n; i++) { // for(int j = 1; j <= m; j++) { // cout << dp[i][j] << " "; // } // cout << endl; // } for(int i = 1; i <= m; i++) { ans += dp[n][i]; ans %= mod; } cout << ans << endl; } signed main() { SPEED; intt tst = 1; // cin >> tst; while (tst--) { solve(); } return 0; }

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

trener.cpp: In function 'bool check(const string&, const string&)':
trener.cpp:19:1: warning: no return statement in function returning non-void [-Wreturn-type]
   19 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...