Submission #1283823

#TimeUsernameProblemLanguageResultExecution timeMemory
1283823dhuyyyyRobots (APIO13_robots)C++20
0 / 100
1 ms332 KiB
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second

using namespace std;

using ii = pair<int,int>;

const int MOD = 1e9+7;
const int N = 6005;
const int S = 17;

bool M1;
int n, m, c, d, e, x, y, ans = 0;

int pre[N][N];

bool ok(int x){
    for (int i = x; i <= n; i++){
        for (int j = x; j <= m; j++){
            if (pre[i][j] - pre[i-x][j] - pre[i][j-x] + pre[i-x][j-x] <= e){
                return 1;
            }
        }
    }
    return 0;
}
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    freopen("PAPER.inp","r",stdin);
    freopen("PAPER.out","w",stdout);
    cin >> n >> m >> c >> d >> e;
    for (int i = 1; i <= c; i++){
        cin >> x >> y;
        pre[x][y]++;
    }
    for (int i = 1; i <= n; i++){
        for (int j = 1; j <= m; j++){
            pre[i][j] += pre[i-1][j] + pre[i][j-1] - pre[i-1][j-1];
        }
    }
    int l = 1, r = min(n,m) / d;
    while (l <= r){
        int mid = (l + r) >> 1;
        if (ok(mid * d)){
            ans = mid;
            l = mid + 1;
        } else r = mid - 1;
    }
    cout << ans * d;
    return 0;
}

Compilation message (stderr)

robots.cpp: In function 'int main()':
robots.cpp:32:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |     freopen("PAPER.inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
robots.cpp:33:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |     freopen("PAPER.out","w",stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...