Submission #600954

#TimeUsernameProblemLanguageResultExecution timeMemory
600954l_rehoQuality Of Living (IOI10_quality)C++14
0 / 100
2 ms440 KiB
#include <bits/stdc++.h> using namespace std; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { int ans = 0; set<int> st; for(int i = 0; i < W; i++) for(int j = 0; j < H; j++) st.insert(Q[j][i]); auto it = st.begin(); advance(it, (W*H)/2); ans = *it; bool back = 0; for(int k = 0; k <= R-H; k++){ if(!back){ for(int i = 1; i <= C-W; i++){ // elimino la parte precedente for(int j = k; j < H+k; j++){ st.erase(Q[j][i-1]); st.insert(Q[j][i+W-1]); } auto it = st.begin(); advance(it, (W*H)/2); ans = min(ans, *it); } }else{ for(int i = C-W-1; i >= 0; i--){ // elimino la parte precedente for(int j = k; j < H+k; j++){ st.erase(Q[j][i+W-1]); st.insert(Q[j][i]); } auto it = st.begin(); advance(it, (W*H)/2); ans = min(ans, *it); } } if(!back){ for(int i = C-W; i < C; i++){ st.erase(Q[k][i]); st.insert(Q[k+H][i]); } }else{ for(int i = 0; i < W; i++){ st.erase(Q[k][i]); st.insert(Q[k+H][i]); } } auto it = st.begin(); advance(it, (W*H)/2); ans = min(ans, *it); back^=1; } return ans; }
#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...