# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1047696 |
2024-08-07T15:10:04 Z |
vjudge1 |
Rectangles (IOI19_rect) |
C++17 |
|
1 ms |
604 KB |
#include "rect.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define ff first
#define all(x) x.begin(), x.end()
#define ss second
const int N = 2600, K = 15;
int rmq[N][K];
int get(int l, int r){
int k = int(log2(r-l+1));
return max(rmq[l][k], rmq[r-(1<<k)+1][k]);
}
long long count_rectangles(std::vector<std::vector<int> > a) {
int n = a.size();
int m = a[0].size();
if(n == 3){
vector<bool> good(m);
for(int i = 1; i + 1 < m; ++i){
if(a[i][1] < a[i][0] && a[i][1] < a[i][2]){
good[i] = 1;
}else good[i] = 0;
}
for(int i = 1; i + 1 < m; ++i) rmq[i][0] = (good[i] ? a[i][1]: INT_MAX);
for(int j = 1; j < K; ++j){
for(int i = 1; i + (1<<j) <= m - 1; ++i){
rmq[i][j] = max(rmq[i][j - 1], rmq[i+(1<<(j-1))][j-1]);
}
}
int ans = 0;
for(int i = 1; i + 1 < m; ++i){
for(int j = i; j + 1 < m; ++j){
if(get(i, j) < min(a[i - 1][1], a[j + 1][1])){
ans = max(ans, j - i + 1);
}
}
}
return ans;
}
return 1;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
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 |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |