# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
367386 |
2021-02-17T05:22:10 Z |
ijxjdjd |
Flood (IOI07_flood) |
C++14 |
|
0 ms |
0 KB |
using namespace std;
#include <bits/stdc++.h>
#include "quality.h"
#pragma GCC optimize ("Ofast")
#pragma GCC target("avx2")
#define FR(i, N) for (int i = 0; i < int(N); i++)
#define all(x) begin(x), end(x)
int pref[3001][3001];
pair<int, int> coords[3001*3001];
int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
int low = 0;
int high = R*C-1;
FR(i, R){
FR(j, C){
coords[Q[i][j]-1] = {i, j};
}
}
int base = H*W/2;
while (low < high) {
int mid = (low + high)/2;
memset(pref, 0, sizeof(pref));
FR(i, mid+1) {
pref[coords[i].first][coords[i].second]++;
}
FR(i, R) {
FR(j, C) {
pref[i][j] += (i > 0 ? pref[i-1][j] : 0) + (j > 0 ? pref[i][j-1] : 0) - (i > 0 && j > 0 ? pref[i-1][j-1] : 0);
if (pref[i][j] - (i >= H ? pref[i-H][j] : 0) - (j >= W ? pref[i][j-W] : 0) + (j >= W && i >= H ? pref[i-H][j-W] : 0) > base) {
high = mid;
}
}
}
if (high != mid) {
low = mid+1;
}
}
return high+1;
}
Compilation message
flood.cpp:3:10: fatal error: quality.h: No such file or directory
3 | #include "quality.h"
| ^~~~~~~~~~~
compilation terminated.