Submission #261394

#TimeUsernameProblemLanguageResultExecution timeMemory
261394SuperJavaRectangles (IOI19_rect)C++17
Compilation error
0 ms0 KiB
#include "rect.h" #include <vector> #include <math> #define sz(a) (a.size()) using namespace std; int spr[705][10][705]; int lg[705]; int query_r(int row, int l, int r){ int logo = lg[r-l+1]; return min(spr[row][logo][l],spr[row][logo][r-(1<<logo)+1]); } int query_c(int col, int l, int r){ int logo = lg[r-l+1]; return min(spc[row][logo][l],spc[row][logo][r-(1<<logo)+1]); } long long count_rectangles(vector<vector<int>> a) { for (int i = 1; i < 705; ++i){ lg[i] = log2(i); } int n = sz(a); int m = sz(a[0]); int answer = 0; for (int i = 0; i < n; ++i){ for (int j = 0; j < m; ++j){ spr[i][0][j] = a[i][j]; } for (int k = 1; k < 10; ++k){ for (int j = 0; j < n-(1<<k)+1; ++j){ spr[i][k][j] = min(spr[i][k-1][j], spr[i][k-1][j+(1<<(k-1))]); } } } for (int i = 0; i < n; ++i){ for (int j = 0; j < m; ++j){ spc[i][0][j] = a[j][i]; } for (int k = 1; k < 10; ++k){ for (int j = 0; j < n-(1<<k)+1; ++j){ spc[i][k][j] = min(spc[i][k-1][j], spc[i][k-1][j+(1<<(k-1))]); } } } for (int r1 = 1; r1 < n-1; ++r1){ for (int c1 = 1; c1 < m-1; ++c1){ for (int r2 = r1; r2 < n-1; ++r2){ if(a[r2][c1] >= a[r2][c1-1] || a[r2][c1] >= a[r1-1][c1]){ break; } bool milhem = false; for (int c2 = c1; c2 < m-1 && !milhem; ++c2){ bool good = true; for (int i = r1; i <= r2 && good; ++i){ int mn = query_r(i, c1, c2); if(mn >= a[i][c1-1]){ good = false; milhem = true; } if(mn >= a[i][c2+1]){ good = false; } } for (int i = c1; i <= c2 && good; ++i){ int mn = query_c(i, r1, r2); if(mn >= a[r1-1][i] || mn >= a[r2+1][i]){ good = false; milhem = true; } } if(good){ answer++; } } } } } return answer; }

Compilation message (stderr)

rect.cpp:3:10: fatal error: math: No such file or directory
 #include <math>
          ^~~~~~
compilation terminated.