Submission #287471

#TimeUsernameProblemLanguageResultExecution timeMemory
287471Haunted_CppRectangles (IOI19_rect)C++17
0 / 100
2 ms640 KiB
#include "rect.h" #include <bits/stdc++.h> using namespace std; long long count_rectangles(vector<vector<int> > mat) { const int r = mat.size(); const int c = mat[0].size(); if (r <= 2) { return 0; } if (c <= 2) { return 0; } // Subtask #1 && Subtask #2 long long res = 0; for (int i = 1; i < r - 1; i++) { for (int j = 1; j < c - 1; j++) { bitset<100> valid; valid.set(); vector<int> col_max(c); for (int x = i; x < r - 1; x++) { int mx = 0; bool valid_state = true; for (int z = j; z < c - 1; z++) { const int L = mat[x][j - 1]; const int R = mat[x][z + 1]; mx = max(mx, mat[x][z]); col_max[z] = max(col_max[z], mat[x][z]); if (mx >= L || mx >= R) { valid[z] = 0; continue; } const int up = mat[i - 1][z]; const int down = mat[x + 1][z]; if (col_max[z] >= up || col_max[z] >= down) { valid_state = false; continue; } if (!valid_state) { continue; } if (!valid[z]) { continue; } ++res; } } } } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...