# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1004712 |
2024-06-21T13:07:13 Z |
Lini |
Dijamant (COCI22_dijamant) |
C++14 |
|
1000 ms |
43088 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 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
2 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2392 KB |
Output is correct |
10 |
Correct |
1 ms |
2392 KB |
Output is correct |
11 |
Correct |
1 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2544 KB |
Output is correct |
14 |
Correct |
127 ms |
43088 KB |
Output is correct |
15 |
Execution timed out |
1014 ms |
41040 KB |
Time limit exceeded |
16 |
Halted |
0 ms |
0 KB |
- |