(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1090611

#TimeUsernameProblemLanguageResultExecution timeMemory
1090611namduong93Quality Of Living (IOI10_quality)C++14
0 / 100
3 ms856 KiB
/** * author: namduong93 * created: unknown * complexity: unknown **/ #include <bits/stdc++.h> using namespace std; #define fto(i, a, b) for (int i = a; i <= b; ++i) #define fdo(i, a, b) for (int i = a; i >= b; --i) #define mp make_pair #define fi first #define se second #define pb push_back #define vi vector<int> #define SZ(x) ((int)(x).size()) int get_bit(int x, int i) { return x & (1 << i); } int turn_bit(int x, int i) { return x | (1 << i); } int swap_bit(int x, int i) { return x ^ (1 << i); } typedef pair<int, int> pii; typedef long long ll; const int mod = 998244353; const int N = 3002; const int inf = 1e9 + 7; int n; int R, C, H, W; int Q[N][N], tmp_Q[N][N], sum[N][N]; string str; stack<int> st; priority_queue<pii, vector<pii>, greater<pii>> d_heap; multiset<int> ms; int find(int m) { fto(i,1,R) fto(j,1,C) { if(Q[i][j] == m) tmp_Q[i][j] = 0; if(Q[i][j] < m) tmp_Q[i][j] = -1; if(Q[i][j] > m) tmp_Q[i][j] = 1; } fto(i,1,R) { fto(j,1,C) { sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + tmp_Q[i][j]; } } bool exist = false; fto(i,H,R) fto(j,W,C) { int guess = sum[i][j] - sum[i - H][j] - sum[i][j - W] + sum[i - H][j - W]; if(guess < 0) return -1; if (guess == 0) exist = true; } if(exist) return 0; return 1; } int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { cin >> R >> C >> H >> W; fto(i,1,R) { fto(j,1,C) cin >> Q[i][j]; } int l = 1; int r = R*C; int result = -1; while(l <= r) { int m = (l + r) / 2; int tmp = find(m); if(tmp == 0) { result = m; } if(tmp <= 0) { r = m - 1; } else l = m + 1; } cout << result; }

Compilation message (stderr)

quality.cpp: In function 'int rectangle(int, int, int, int, int (*)[3001])':
quality.cpp:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
   84 | }
      | ^
#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...