(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 #1090608

#TimeUsernameProblemLanguageResultExecution timeMemory
1090608namduong93Quality Of Living (IOI10_quality)C++14
Compilation error
0 ms0 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 a[N][N], tmp_a[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(a[i][j] == m) tmp_a[i][j] = 0; if(a[i][j] < m) tmp_a[i][j] = -1; if(a[i][j] > m) tmp_a[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_a[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; } void Solve() { cin >> R >> C >> H >> W; fto(i,1,R) { fto(j,1,C) cin >> a[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; } int32_t main() { if (fopen("test.inp", "r")) freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int Test = 1; // cin >> Test; fto(iTest, 1, Test) { Solve(); } // cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; return 0; }

Compilation message (stderr)

quality.cpp: In function 'int32_t main()':
quality.cpp:90:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   90 |         freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
quality.cpp:90:49: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   90 |         freopen("test.inp", "r", stdin), freopen("test.out", "w", stdout);
      |                                          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: /tmp/ccWQ1uGW.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccbmaFwU.o:quality.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccWQ1uGW.o: in function `main':
grader.cpp:(.text.startup+0xe9): undefined reference to `rectangle(int, int, int, int, int (*) [3001])'
collect2: error: ld returned 1 exit status