# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1047720 |
2024-08-07T15:19:47 Z |
vjudge1 |
Rectangles (IOI19_rect) |
C++17 |
|
173 ms |
103556 KB |
#include "rect.h"
#include <bits/stdc++.h>
#define inf ((int)1e9)
using namespace std;
long long count_rectangles(std::vector<std::vector<int> > a) {
vector <vector<int> > next, cnt;
// bi birlerde kendinden bir sonraki sıfırı tutuyoruz
// bir de gene birlerde kendinden sonraki ardışık sıfır sayısını tutuyoruz
int n = a.size(), m = a[0].size();
next = cnt = vector <vector<int> > (n, vector<int>(m));
for(int i = 0; i < n; i++) {
int zero = m;
for(int j = m - 1; j > 0; j--) {
if(a[i][j]) {
next[i][j] = zero;
}
else {
zero = j;
}
}
int before = 0;
for(int j = 0; j < m; j++) {
if(a[i][j]) {
before = j;
}
else {
cnt[i][before]++;
}
}
}
// column column gez
// duvara çarpma edge casesi, 0 alan edge casesi
long long ans = 0;
for(int j = 1; j < m - 1; j++) {
int val = -1, prevdist = 0;
for(int i = 0; i < n; i++) {
if(a[i][j]) {
int dist = next[i][j] - j;
if(prevdist >= val and dist >= val and val != inf and val > 0 and j + val != m) {
ans++;
}
val = -1;
prevdist = dist;
}
else if(a[i][j - 1]) {
if(val == -1) {
val = cnt[i][j - 1];
}
else if(val != cnt[i][j - 1]) val = inf;
}
else {
val = inf;
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
82 ms |
45220 KB |
Output is correct |
3 |
Correct |
157 ms |
100236 KB |
Output is correct |
4 |
Correct |
171 ms |
101456 KB |
Output is correct |
5 |
Correct |
173 ms |
103556 KB |
Output is correct |
6 |
Correct |
46 ms |
51536 KB |
Output is correct |
7 |
Correct |
100 ms |
97104 KB |
Output is correct |
8 |
Correct |
105 ms |
103264 KB |
Output is correct |
9 |
Correct |
0 ms |
600 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |