Submission #223328

#TimeUsernameProblemLanguageResultExecution timeMemory
223328jamielimTrener (COCI20_trener)C++14
Compilation error
0 ms0 KiB
typedef long long ll; const ll MOD=1000000007; string str[55][1505]; vector<pair<string,int> > str2[55]; int main(){ int n,k; scanf("%d%d",&n,&k); char temp[55]; for(int i=0;i<n;i++){ for(int j=0;j<k;j++){ scanf("%s",temp); str[i][j]=temp; } sort(str[i],str[i]+k); if(i!=0){ for(int j=0;j<k;j++){ string a,b; for(int l=0;l<i;l++){ a+=str[i][j][l]; b+=str[i][j][l+1]; } if(a==b)str2[i].push_back(make_pair(a,j)); else str2[i].push_back(make_pair(a,j)),str2[i].push_back(make_pair(b,j)); } sort(str2[i].begin(),str2[i].end()); //for(int j=0;j<2*k;j++)printf("%s ",str2[i][j].first.c_str()); //printf("\n"); } } ll dp[2][k]; memset(dp,0,sizeof(dp)); for(int i=0;i<k;i++)dp[1][i]=1; for(int i=n-2;i>=0;i--){ int ptr=0; for(int j=0;j<k;j++){ if(j>0&&str[i][j]==str[i][j-1]){ dp[0][j]=dp[0][j-1];continue; } while(ptr<(int)str2[i+1].size()){ if(str[i][j]==str2[i+1][ptr].first){ dp[0][j]+=dp[1][str2[i+1][ptr].second]; dp[0][j]%=MOD; }else if(str[i][j]<str2[i+1][ptr].first)break; ptr++; } } for(int j=0;j<k;j++){dp[1][j]=dp[0][j];dp[0][j]=0;} } ll ans=0; for(int i=0;i<k;i++){ans+=dp[1][i];ans%=MOD;} printf("%lld",ans); }

Compilation message (stderr)

trener.cpp:3:1: error: 'string' does not name a type; did you mean 'struct'?
 string str[55][1505];
 ^~~~~~
 struct
trener.cpp:4:1: error: 'vector' does not name a type
 vector<pair<string,int> > str2[55];
 ^~~~~~
trener.cpp: In function 'int main()':
trener.cpp:8:2: error: 'scanf' was not declared in this scope
  scanf("%d%d",&n,&k);
  ^~~~~
trener.cpp:13:4: error: 'str' was not declared in this scope
    str[i][j]=temp;
    ^~~
trener.cpp:15:8: error: 'str' was not declared in this scope
   sort(str[i],str[i]+k);
        ^~~
trener.cpp:15:3: error: 'sort' was not declared in this scope
   sort(str[i],str[i]+k);
   ^~~~
trener.cpp:15:3: note: suggested alternative: 'short'
   sort(str[i],str[i]+k);
   ^~~~
   short
trener.cpp:18:5: error: 'string' was not declared in this scope
     string a,b;
     ^~~~~~
trener.cpp:18:5: note: suggested alternative: 'struct'
     string a,b;
     ^~~~~~
     struct
trener.cpp:20:6: error: 'a' was not declared in this scope
      a+=str[i][j][l];
      ^
trener.cpp:21:6: error: 'b' was not declared in this scope
      b+=str[i][j][l+1];
      ^
trener.cpp:23:8: error: 'a' was not declared in this scope
     if(a==b)str2[i].push_back(make_pair(a,j));
        ^
trener.cpp:23:11: error: 'b' was not declared in this scope
     if(a==b)str2[i].push_back(make_pair(a,j));
           ^
trener.cpp:23:13: error: 'str2' was not declared in this scope
     if(a==b)str2[i].push_back(make_pair(a,j));
             ^~~~
trener.cpp:23:31: error: 'make_pair' was not declared in this scope
     if(a==b)str2[i].push_back(make_pair(a,j));
                               ^~~~~~~~~
trener.cpp:24:10: error: 'str2' was not declared in this scope
     else str2[i].push_back(make_pair(a,j)),str2[i].push_back(make_pair(b,j));
          ^~~~
trener.cpp:24:28: error: 'make_pair' was not declared in this scope
     else str2[i].push_back(make_pair(a,j)),str2[i].push_back(make_pair(b,j));
                            ^~~~~~~~~
trener.cpp:26:9: error: 'str2' was not declared in this scope
    sort(str2[i].begin(),str2[i].end());
         ^~~~
trener.cpp:31:15: error: 'memset' was not declared in this scope
  ll dp[2][k]; memset(dp,0,sizeof(dp));
               ^~~~~~
trener.cpp:36:12: error: 'str' was not declared in this scope
    if(j>0&&str[i][j]==str[i][j-1]){
            ^~~
trener.cpp:36:12: note: suggested alternative: 'ptr'
    if(j>0&&str[i][j]==str[i][j-1]){
            ^~~
            ptr
trener.cpp:39:19: error: 'str2' was not declared in this scope
    while(ptr<(int)str2[i+1].size()){
                   ^~~~
trener.cpp:39:19: note: suggested alternative: 'ptr'
    while(ptr<(int)str2[i+1].size()){
                   ^~~~
                   ptr
trener.cpp:40:8: error: 'str' was not declared in this scope
     if(str[i][j]==str2[i+1][ptr].first){
        ^~~
trener.cpp:40:8: note: suggested alternative: 'ptr'
     if(str[i][j]==str2[i+1][ptr].first){
        ^~~
        ptr
trener.cpp:51:2: error: 'printf' was not declared in this scope
  printf("%lld",ans);
  ^~~~~~
trener.cpp:51:2: note: suggested alternative: 'int'
  printf("%lld",ans);
  ^~~~~~
  int