Submission #1043441

# Submission time Handle Problem Language Result Execution time Memory
1043441 2024-08-04T09:32:23 Z idas Rectangles (IOI19_rect) C++17
13 / 100
122 ms 92320 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++;

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

				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 0 ms 2396 KB Output is correct
2 Correct 51 ms 41560 KB Output is correct
3 Correct 122 ms 91988 KB Output is correct
4 Correct 117 ms 92244 KB Output is correct
5 Correct 113 ms 92304 KB Output is correct
6 Correct 36 ms 49232 KB Output is correct
7 Correct 73 ms 88656 KB Output is correct
8 Correct 77 ms 92320 KB Output is correct
9 Correct 1 ms 2392 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 4444 KB Output is correct
12 Correct 1 ms 4444 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2396 KB Output isn't correct
2 Halted 0 ms 0 KB -