| Task: | Tontti |
| Sender: | Pietu1998 |
| Submission time: | 2015-10-16 16:45:41 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | TIME LIMIT EXCEEDED | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.05 s | 1 | details |
| #2 | ACCEPTED | 0.06 s | 1 | details |
| #3 | WRONG ANSWER | 0.06 s | 1 | details |
| #4 | WRONG ANSWER | 0.06 s | 1 | details |
| #5 | WRONG ANSWER | 0.06 s | 1 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 2 | details |
| #7 | WRONG ANSWER | 0.46 s | 2 | details |
| #8 | ACCEPTED | 0.20 s | 2 | details |
| #9 | ACCEPTED | 0.15 s | 2 | details |
| #10 | WRONG ANSWER | 0.13 s | 2 | details |
| #11 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #12 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #13 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #14 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #15 | TIME LIMIT EXCEEDED | -- | 3 | details |
Code
#include <iostream>
using namespace std;
#define D 0
int main(){
int n,m,X;
cin>>n>>m>>X;
char k[n][m];
for(int y=0;y<n;y++){
for(int x=0;x<m;x++){
char c;
cin>>c;
k[y][x]=(c=='*')?1:0;
#if D
cout<<int(k[y][x]);
#endif
}
#if D
cout<<endl;
#endif
}
int T=0;
for(int I=0;I<m;I++){
int mx=min(n+I,m);
int p=0;
for(int x=I,y=0,w=1;x+w<=mx;w++){
for(int i=x;i<x+w;i++)p+=k[y+w-1][i];
for(int i=y;i<y+w-1;i++)p+=k[i][x+w-1];
#if D
cout<<x<<' '<<y<<' '<<w<<' '<<p<<endl;
#endif
while(p>X){
for(int i=x;i<x+w;i++)p-=k[y][i];
for(int i=y+1;i<y+w;i++)p-=k[i][x];
x++;y++;w--;
#if D
cout<<x<<' '<<y<<' '<<w<<' '<<p<<endl;
#endif
}
if(p==X){
int x_=x,y_=y,w_=w,p_=p;
while(p_==X){
T++;
for(int i=x_;i<x_+w_;i++)p_-=k[y_][i];
for(int i=y_+1;i<y_+w_;i++)p_-=k[i][x_];
x_++;y_++;w_--;
#if D
cout<<x_<<' '<<y_<<' '<<w_<<' '<<p_<<endl;
#endif
}
}
}
if(p==X)T++;
}
for(int I=1;I<m;I++){
int my=min(n,m+I);
int p=0;
for(int y=I,x=0,w=1;y+w<=my;w++){
for(int i=x;i<x+w;i++)p+=k[y+w-1][i];
for(int i=y;i<y+w-1;i++)p+=k[i][x+w-1];
#if D
cout<<x<<' '<<y<<' '<<w<<' '<<p<<endl;
#endif
while(p>X){
for(int i=x;i<x+w;i++)p-=k[y][i];
for(int i=y+1;i<y+w;i++)p-=k[i][x];
x++;y++;w--;
#if D
cout<<x<<' '<<y<<' '<<w<<' '<<p<<endl;
#endif
}
if(p==X){
int x_=x,y_=y,w_=w,p_=p;
while(p_==X){
T++;
for(int i=x_;i<x_+w_;i++)p_-=k[y_][i];
for(int i=y_+1;i<y_+w_;i++)p_-=k[i][x_];
x_++;y_++;w_--;
#if D
cout<<x_<<' '<<y_<<' '<<w_<<' '<<p_<<endl;
#endif
}
}
}
}
cout<<T<<endl;
}Test details
Test 1
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 1 ......*... .......*.. *..*....*. *....*.... ... |
| correct output |
|---|
| 94 |
| user output |
|---|
| 100 |
Test 2
Group: 1
Verdict: ACCEPTED
| input |
|---|
| 10 10 5 ********** ********** ********** ********** ... |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 3
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 10 **...*...* *..*.**.*. ...**.*..* *...**.*.. ... |
| correct output |
|---|
| 4 |
| user output |
|---|
| 6 |
Test 4
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 5 ****...... *.*.**..** ....*.*..* ...*.***.. ... |
| correct output |
|---|
| 16 |
| user output |
|---|
| 19 |
Test 5
Group: 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 10 2 **.***..*. ...*.*.... .***.*...* ***.***..* ... |
| correct output |
|---|
| 30 |
| user output |
|---|
| 32 |
Test 6
Group: 2
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 500 500 1 ................................. |
| correct output |
|---|
| 9552040 |
| user output |
|---|
| (empty) |
Test 7
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 500 500 5 ................................. |
| correct output |
|---|
| 1536063 |
| user output |
|---|
| 1536432 |
Test 8
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 500 500 25000 **...*...**..*.*..*.**.*..*.*.... |
| correct output |
|---|
| 288 |
| user output |
|---|
| 288 |
Test 9
Group: 2
Verdict: ACCEPTED
| input |
|---|
| 500 500 12500 **.**.*..*...*.**...*.***........ |
| correct output |
|---|
| 786 |
| user output |
|---|
| 786 |
Test 10
Group: 2
Verdict: WRONG ANSWER
| input |
|---|
| 500 500 5000 .*.*.**..*.*.**.**..*..**...*.... |
| correct output |
|---|
| 1763 |
| user output |
|---|
| 1769 |
Test 11
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 2000 1 ................................. |
| correct output |
|---|
| 489611392 |
| user output |
|---|
| (empty) |
Test 12
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 2000 5 ................................. |
| correct output |
|---|
| 120725884 |
| user output |
|---|
| (empty) |
Test 13
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 2000 400000 ..*..**.**.**.*.***...**.*..**... |
| correct output |
|---|
| 1849 |
| user output |
|---|
| (empty) |
Test 14
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 2000 200000 ***.*....*.*..*....**..*..*.*.... |
| correct output |
|---|
| 2665 |
| user output |
|---|
| (empty) |
Test 15
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 2000 2000 80000 **.**...*.***.**....**.*....*.... |
| correct output |
|---|
| 5587 |
| user output |
|---|
| (empty) |
