# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
846051 | 2023-09-07T08:46:39 Z | vjudge1 | Trener (COCI20_trener) | C++17 | 3 ms | 2652 KB |
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #pragma GCC optimize("O3,fast-math,inline") #include <bits/stdc++.h> using namespace std; #define fr freopen("in.txt","r",stdin);freopen("out.txt","w",stdout); #define int long long #define endl "\n" const int mod = (int)(1e9+7); #define all(x) x.begin(),x.end() int mxn = 1e18; int mnn = -mxn; void outarr(int ans[],int n) { for (int i = 0; i < n; i++) cout << ans[i] << " \n"[i == n - 1]; } int binpow(int base,int power) { if(power == 1) return base; if(power == 0) return 1; if(power&2) { int a; a = binpow(base,(power-1)/2); return a*a*base; } else { int a; a = binpow(base,power/2); return a*a; } } int gcd(int a, int b) { if(b == 0) { return a; } else { return gcd(b, a % b); } } int lcm(int a,int b) { return (a*b)/gcd(a,b); } int cvp = 0; int n,k; string s[1500][50]; void func(int i,int j) { if(j == k) { return; } if(i == n) return; if(i == n-1) { cvp++; cvp%=mod; return; } for(int k1 = 0;k>k1;k1++) { string it = s[i+1][k1]; int i1 = 0; int j1 = 0; for(int l = 1;i+2>l;l++) { if(s[i][j][l-1] != it[l]) { i1 = -1; break; } i1++; } for(int l = 0;i+1>l;l++) { if(s[i][j][l] != it[l]) { j1 = -1; break; } j1++; } if(i1 == i+1 || j1 == i+1) { func(i+1,k1); } } if(i == 0) func(i,j+1); } void solve() { cin >> n >> k; for(int i = 0;n>i;i++) { for(int j = 0;k>j;j++) cin >> s[i][j]; } func(0,0); cout << cvp << endl; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); fr int t; t=1; //cin >> t; while(t--) solve(); } //template
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |