Submission #1043419

# Submission time Handle Problem Language Result Execution time Memory
1043419 2024-08-04T09:19:03 Z idas Rectangles (IOI19_rect) C++17
0 / 100
54 ms 47160 KB
#include "rect.h"
#include "bits/stdc++.h"
#define FOR(i, begin, end) for(int i=(begin); i<(end); i++)
#define s second
#define f first

using namespace std;
typedef pair<int, int> pii;

const int MxN=2510;
int n, m, a[MxN][MxN];
bool v[MxN][MxN];

long long count_rectangles(std::vector<std::vector<int> > A) {
	n=A.size(); m=A[0].size();
	FOR(i, 0, n) FOR(j, 0, m) a[i][j]=A[i][j];

	int ans=0;
	FOR(i, 1, n-1) {
		FOR(j, 1, m-1) {
			if(!v[i][j] && a[i][j]==0) {
				int x=i; while(x+1<=n-2 && a[x+1][j]==0) x++;
				int y=j; while(y+1<=m-2 && a[i][y+1]==0) y++;

				bool ok=true;
				FOR(k, i, x+1) {
					FOR(l, j, y+1) {
						ok&=a[k][l]==0;
						v[k][l]=true;
					}
				}

				FOR(k, i, x+1) {
					ok&=a[k][j-1];
					ok&=a[k][y+1];
					if(!ok) break;
				}

				FOR(l, j, y+1) {
					ok&=a[i-1][l];
					ok&=a[x+1][l];
					if(!ok) break;
				}

				ans+=ok;
			}
		}
	}

	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Incorrect 54 ms 47160 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -