Submission #845731

# Submission time Handle Problem Language Result Execution time Memory
845731 2023-09-06T15:07:47 Z vjudge1 Trener (COCI20_trener) C++
22 / 110
8 ms 1372 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 < vector <string> > strarr;
	long long arr[50][1500];
	memset(arr,0,sizeof(arr));
	vector <string> den;
	cin>>a>>b;
	for(long long i=0;a>i;i++){
		strarr.push_back(den);
		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];
					}

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


	
}

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;
      |                ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 1368 KB Output is correct
2 Correct 3 ms 1372 KB Output is correct
3 Correct 3 ms 1372 KB Output is correct
4 Incorrect 8 ms 1372 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 860 KB Output is correct
2 Correct 1 ms 860 KB Output is correct
3 Correct 1 ms 860 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 3 ms 1368 KB Output is correct
6 Correct 3 ms 1372 KB Output is correct
7 Correct 3 ms 1372 KB Output is correct
8 Incorrect 8 ms 1372 KB Output isn't correct
9 Halted 0 ms 0 KB -