Submission #995999

# Submission time Handle Problem Language Result Execution time Memory
995999 2024-06-10T06:57:02 Z lacito Quality Of Living (IOI10_quality) C++14
60 / 100
5000 ms 24400 KB
#include "quality.h"
#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
  

int rectangle(int R, int C, int H, int W, int Q[3001][3001]) {
	int ans = R * C;
	int mid = H * W / 2;
	for (int a = 0; a + H <= R; a++) {
		ordered_set os;
		for (int i = 0; i < H; i++) {
			for (int j = 0; j < W; j++) {
				os.insert(Q[a + i][j]);
			}
		}
		// cerr << *os.find_by_order(mid) << " ";
		ans = min(ans, *os.find_by_order(mid));

		for (int b = 0; b + W < C; b++) {
			// remove in column b, add in column b+W
			for (int i = 0; i < H; i++) {
				os.erase(Q[a + i][b]);
				os.insert(Q[a + i][b + W]);
			}
			// cerr << *os.find_by_order(mid) << " ";
			ans = min(ans, *os.find_by_order(mid));
		}
		// cerr << endl;
	}
	// cerr << endl;
	return ans;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 50 ms 2692 KB Output is correct
5 Correct 41 ms 2396 KB Output is correct
6 Correct 41 ms 2648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 50 ms 2692 KB Output is correct
5 Correct 41 ms 2396 KB Output is correct
6 Correct 41 ms 2648 KB Output is correct
7 Correct 2447 ms 5884 KB Output is correct
8 Correct 1817 ms 6492 KB Output is correct
9 Correct 2009 ms 5472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 50 ms 2692 KB Output is correct
5 Correct 41 ms 2396 KB Output is correct
6 Correct 41 ms 2648 KB Output is correct
7 Correct 2447 ms 5884 KB Output is correct
8 Correct 1817 ms 6492 KB Output is correct
9 Correct 2009 ms 5472 KB Output is correct
10 Execution timed out 5012 ms 24400 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2392 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 50 ms 2692 KB Output is correct
5 Correct 41 ms 2396 KB Output is correct
6 Correct 41 ms 2648 KB Output is correct
7 Correct 2447 ms 5884 KB Output is correct
8 Correct 1817 ms 6492 KB Output is correct
9 Correct 2009 ms 5472 KB Output is correct
10 Execution timed out 5012 ms 24400 KB Time limit exceeded
11 Halted 0 ms 0 KB -