# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1004707 |
2024-06-21T13:03:19 Z |
Lini |
Dijamant (COCI22_dijamant) |
C++14 |
|
1 ms |
2392 KB |
/*
7 18
#.#.##
.#.#.#
#.#.#.
*/
#include <iostream>
#include <vector>
using namespace std;
char f[20000][20000];
bool yes;
bool check(int il, int jl, int ir, int jr){
// cout<<"check: "<<il<<", "<<jl<<" to "<<ir<<", "<<jr<<endl;
for (int a=1; a<jr-jl; a++){
if (f[il+a][jl+a]!='#' or f[ir+a][jr+a]!='#'){return false;}//cout<<il<<", "<<jl<<" to "<<ir<<", "<<jr<<" fails 1"<<endl;return false;}
// else {cout<<il+a<<", "<<jl+a<<" and "<<ir+a<<", "<<jr+a<<": #"<<endl;}
for (int b=1; b<jr-jl; b++){
if (f[il+a-b][jl+a+b]!='.'){return false;}//cout<<il<<", "<<jl<<" to "<<ir<<", "<<jr<<" fails 2"<<endl;return false;}
// else cout<<il+a-b<<", "<<jl+a+b<<" and "<<ir+a-b<<", "<<jr+a+b<<": ."<<endl;
}
}
for (int c=0; c<jr-jl; c++){
for (int d=0; d<jr-jl; d++){
//cout<<"checking "<<il+1+c-d<<","<<jl+1+c+d<<endl;
if (f[il+c-d][jl+1+c+d]!='.'){return false;}//cout<<"not . at "<<il+1-d<<", "<<jl+1+d<<endl;cout<<il<<", "<<jl<<" to "<<ir<<", "<<jr<<" fails 3"<<endl;return false;}
// else cout<<il+1-d<<", "<<jl+1+d<<": ."<<endl;
}
}
for (int e=0; e<=jr-jl; e++){
if (f[il+jr-jl-e][jl+jr-jl+e]!='#'){return false;}
}
return true;
}
int main(){
long n, m;
cin>>n;
cin>>m;
cout<<f[n+m-2][n+m-2];
for (int i=0; i<n; i++){
for (int j=0; j<m; j++){
char r;
cin>>r;
f[i][j]=r;
}
//cout<<endl;
}
int count=0;
for (int i=1; i<n+m-1; i++){
for (int j=0; j<=i; j++){
if (f[i-j][j]=='#'){
int c=1;
while (i-j-c>-1){
if (f[i-j-c][j+c]=='#'){c++;}
else break;
}
if (c>1){
for (int r=0; r<c; r++){
for (int l=0; l<r; l++){
// cout<<"check: "<<l<<", "<<r<<endl;
if (check(i-j-l, j+l, i-j-r, j+r)){count++;}//cout<<"success"<<endl;}
}
}
}
j+=c;
}
}
}
cout<<count<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2392 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |