Submission #153389

# Submission time Handle Problem Language Result Execution time Memory
153389 2019-09-14T02:54:27 Z tinjyu Rectangles (IOI19_rect) C++14
0 / 100
24 ms 508 KB
#include "rect.h"
#include <iostream>
#include <cstring>
using namespace std;
long long int ma1[2505],ma2[2505],tag[2505][2505],sx,sy,x,y,n,m,ans=0,map[2505][2505],cnt;
int bfs(long long int a,long long int b)
{
	cnt++;
	tag[a][b]=1;
	sx=min(a,sx);
	sy=min(b,sy);
	x=max(a,x);
	y=max(b,y);
	for(int i=1;i<=4;i++)
	{
		int tmpx=a,tmpy=b;
		if(i==1)tmpx++;
		if(i==2)tmpy++;
		if(i==3)tmpy--;
		if(i==4)tmpx--;
		if(tmpx>=0 && tmpx<n && tmpy>=0 && tmpy<m && map[tmpx][tmpy]==0 && tag[tmpx][tmpy]==0)
		{
			bfs(tmpx,tmpy);
		}
	}
}
long long count_rectangles(std::vector<std::vector<int> > a) {
	n=a.size();
	m=a[0].size();
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)map[i][j]=a[i][j];
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<m;j++)
		{
			if(tag[i][j]==1 || map[i][j]==1)continue;
			sx=i;
			sy=j;
			x=i;
			y=j;
			cnt=0;
			bfs(i,j);
			cout<<i<<" "<<j<<" "<<cnt<<endl;
			if(cnt==(x-sx+1)*(y-sy+1) && x!=n-1 && y!=m-1 && sx!=0 && sy!=0)ans++;
		}
	}
	return ans;
}

Compilation message

rect.cpp: In function 'int bfs(long long int, long long int)':
rect.cpp:26:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 24 ms 508 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB secret mismatch
2 Halted 0 ms 0 KB -