Submission #223204

#TimeUsernameProblemLanguageResultExecution timeMemory
223204tqbfjotldTrener (COCI20_trener)C++14
110 / 110
261 ms16068 KiB
#include <bits/stdc++.h> using namespace std; #define MOD 1000000007 unordered_map<string,int> ways; int main(){ int n,k; cin>>n; cin>>k; for (int x = 0; x<n; x++){ for (int y = 0; y<k; y++){ string str; cin>>str; if (str.size()==1){ ways[str]++; } else{ string str1 = ""; string str2 = ""; for (int i = 0; i<str.size(); i++){ if (i!=0){ str2 += str[i]; } if (i!=str.size()-1){ str1+=str[i]; } } if (str1!=str2){ ways[str] += ways[str1]; ways[str] %= MOD; ways[str] += ways[str2]; ways[str] %= MOD; } else{ ways[str] += ways[str1]; ways[str] %=MOD; } } } } int ans = 0; for (auto x : ways){ if (x.first.size()==n){ ans += x.second; ans %= MOD; } } printf("%d",ans); }

Compilation message (stderr)

trener.cpp: In function 'int main()':
trener.cpp:20:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for (int i = 0; i<str.size(); i++){
                                 ~^~~~~~~~~~~
trener.cpp:24:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                     if (i!=str.size()-1){
                         ~^~~~~~~~~~~~~~
trener.cpp:43:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (x.first.size()==n){
             ~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...