Submission #340133

#TimeUsernameProblemLanguageResultExecution timeMemory
340133shrek12357Rectangles (IOI19_rect)C++14
0 / 100
17 ms364 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> #include <stack> #include <bitset> #include "rect.h" using namespace std; #define ll long long //cin.tie(0);ios_base::sync_with_stdio(0); const int MAXN = 2505; int grid[MAXN][MAXN]; int n, m; ll ans1() { if (n == 1 || n == 2) { return 0; } int cnt = 0; for (int i = 1; i < m - 1; i++) { int cur = grid[1][i - 1]; int mx = grid[1][i]; for (int j = i; j < m - 1; j++) { mx = max(mx, grid[1][j]); if (grid[1][j] >= cur || grid[1][j] >= grid[0][j] || grid[1][j] >= grid[2][j] || grid[1][j] >= grid[1][j + 1] || mx >= grid[1][j + 1] || mx >= cur) { continue; } cnt++; } } return cnt; } ll count_rectangles(vector<vector<int>> a) { n = a.size(); m = a[0].size(); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { grid[i][j] = a[i][j]; } } if (n <= 3) { return ans1(); } return 0; }
#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...