답안 #736251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
736251 2023-05-05T11:12:03 Z DangerNoodle7591 Trener (COCI20_trener) C++17
22 / 110
59 ms 24800 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mod 1000000007
#define N 51
#define K 15001
int n,k;
string kelime[N][K];
ll int kactaneyol[N][K];
int main(){
  lalala;
  cin>>n>>k;
  for(int i=0;i<n;i++){
    for(int j=0;j<k;j++){
        string a;cin>>a;
        kelime[i][j]=a;
    }
  }
  for(int i=0;i<k;i++)kactaneyol[0][i]=1;
  for(int i=0;i<n-1;i++){
    for(int j=0;j<k;j++){
      //cout<<kactaneyol[i][j]<<" ";
      string str=kelime[i][j];
      for(int jx=0;jx<k;jx++){
        string s=kelime[i+1][jx][0]+str, t=str+kelime[i+1][jx][i+1];
        if(s==kelime[i+1][jx]|| t==kelime[i+1][jx] ){
          kactaneyol[i+1][jx]+=kactaneyol[i][j];
        }
      }
    }//cout<<endl;
  }
  ll int cev=0;
  for(int i=0;i<k;i++){
    //cout<<kactaneyol[n-1][i]<<" ";
    cev+=kactaneyol[n-1][i];
  }
  cout<<cev<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 24276 KB Output is correct
2 Correct 11 ms 24284 KB Output is correct
3 Correct 14 ms 24280 KB Output is correct
4 Correct 13 ms 24276 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 59 ms 24800 KB Output is correct
2 Correct 53 ms 24764 KB Output is correct
3 Correct 54 ms 24796 KB Output is correct
4 Incorrect 52 ms 24800 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 24276 KB Output is correct
2 Correct 11 ms 24284 KB Output is correct
3 Correct 14 ms 24280 KB Output is correct
4 Correct 13 ms 24276 KB Output is correct
5 Correct 59 ms 24800 KB Output is correct
6 Correct 53 ms 24764 KB Output is correct
7 Correct 54 ms 24796 KB Output is correct
8 Incorrect 52 ms 24800 KB Output isn't correct
9 Halted 0 ms 0 KB -