답안 #846023

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
846023 2023-09-07T06:43:27 Z vjudge1 Trener (COCI20_trener) C++
55 / 110
269 ms 12112 KB
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	long long a,b,c,d;
	string kel;
	vector <string > strarr[55];
	long long arr[55][1505];
	long long mod=1000000007;
	memset(arr,0,sizeof(arr));
	vector <string> den;
	cin>>a>>b;
	for(long long i=0;a>i;i++){
		for(long long j=0;b>j;j++){
			cin>>kel;
			strarr[i].push_back(kel);
		}
	}
	for(long long j=0;b>j;j++){
		arr[a-1][j]=1;
	}
	for(long long i=1;a>=i;i++){
		for(long long j=0;b>j;j++){
			for(long long k=0;b>k;k++){
				long long h=0;
				for(long long ponk = 0;(a-i)>ponk; ponk++){
					if(strarr[a-(i+1)][j][ponk] != strarr[a-(i)][k][ponk]){
						h=1;
						break;
					}
				}
				if(h == 1){
					h=0;
					for(long long ponk = 0;(a-i)>ponk; ponk++){
					if(strarr[a-(i+1)][j][ponk] != strarr[a-(i)][k][ponk+1]){
						h=1;
						break;
					}
					}
					if(h == 0){
						arr[(a-(i+1))][j]=((arr[(a-(i))][k] % mod) + (arr[(a-(i+1))][j] % mod)% mod);
					}

				}
				else{
					arr[(a-(i+1))][j]=((arr[(a-(i))][k] % mod) + (arr[(a-(i+1))][j] % mod)% mod);
				}
			}
		}
	}
	d=0;
	for(long long j=0;b>j;j++){
		d+=arr[0][j];
		d%=mod;
	}
	cout<<d%mod;


	
}

Compilation message

trener.cpp: In function 'int main()':
trener.cpp:6:16: warning: unused variable 'c' [-Wunused-variable]
    6 |  long long a,b,c,d;
      |                ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1368 KB Output is correct
2 Correct 3 ms 1368 KB Output is correct
3 Correct 3 ms 1368 KB Output is correct
4 Correct 7 ms 1368 KB Output is correct
5 Correct 7 ms 1368 KB Output is correct
6 Correct 8 ms 1368 KB Output is correct
7 Correct 7 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 856 KB Output is correct
2 Correct 1 ms 856 KB Output is correct
3 Correct 1 ms 856 KB Output is correct
4 Correct 1 ms 856 KB Output is correct
5 Correct 3 ms 1368 KB Output is correct
6 Correct 3 ms 1368 KB Output is correct
7 Correct 3 ms 1368 KB Output is correct
8 Correct 7 ms 1368 KB Output is correct
9 Correct 7 ms 1368 KB Output is correct
10 Correct 8 ms 1368 KB Output is correct
11 Correct 7 ms 1368 KB Output is correct
12 Runtime error 269 ms 12112 KB Execution killed with signal 11
13 Halted 0 ms 0 KB -