Submission #845279

#TimeUsernameProblemLanguageResultExecution timeMemory
845279vjudge1Trener (COCI20_trener)C++17
55 / 110
2025 ms5468 KiB
#include <bits/stdc++.h> using namespace std; #define fast ios::sync_with_stdio(0);cin.tie(0); #define s second #define f first typedef long long ll; const ll MOD = 1e9 + 7; const ll LOGN = 20; const ll MAXN = 3e5 + 5; vector<vector<string>> play; vector<int> dp(1505); bool check(string a, string b) { bool control1 = true; bool control2 = true; for (int i = 0; i < a.size(); i++) { if (a[i] != b[i]) control1 = false; if (a[i] != b[i+1]) control2 = false; } return (control1 | control2); } int main() { fast int N, K; cin >> N >> K; play = vector<vector<string>>(N+1, vector<string>()); for (int i = 1; i <= N; i++) { for (int j = 0; j < K; j++) { string s; cin >> s; play[i].push_back(s); } } for (int i = 0; i < play[N].size(); i++) dp[i] = 1; for (int i = N-1; i >= 1; i--) { vector<int> new_dp(1505); for (int str1 = 0; str1 < play[i].size(); str1++) { for (int str2 = 0; str2 < play[i+1].size(); str2++) { if (check(play[i][str1], play[i+1][str2])) new_dp[str1] = (new_dp[str1] + dp[str2]) % MOD; } } dp = new_dp; } int ans = 0; for (int str = 0; str < play[1].size(); str++) ans = (ans + dp[str]) % MOD; cout << ans << "\n"; }

Compilation message (stderr)

trener.cpp: In function 'bool check(std::string, std::string)':
trener.cpp:17:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |  for (int i = 0; i < a.size(); i++) {
      |                  ~~^~~~~~~~~~
trener.cpp: In function 'int main()':
trener.cpp:41:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for (int i = 0; i < play[N].size(); i++)
      |                  ~~^~~~~~~~~~~~~~~~
trener.cpp:46:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |   for (int str1 = 0; str1 < play[i].size(); str1++) {
      |                      ~~~~~^~~~~~~~~~~~~~~~
trener.cpp:47:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |    for (int str2 = 0; str2 < play[i+1].size(); str2++) {
      |                       ~~~~~^~~~~~~~~~~~~~~~~~
trener.cpp:56:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |  for (int str = 0; str < play[1].size(); str++)
      |                    ~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...