제출 #1176219

#제출 시각아이디문제언어결과실행 시간메모리
1176219lnwrice삶의 질 (IOI10_quality)C++20
40 / 100
5091 ms3144 KiB
#include "quality.h" #include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { const int n = R, m = C, h = H, w = W; const int MAX = 9000012, MAX_INT = 2000000024; int i, j, k, l; int t = (h*w)/2, min_ = MAX_INT, c; set<int> arr; for(i = 0; i <= n - h; i++) { arr.clear(); for(k = i; k < i + h; k++) { for(l = 0; l < w; l++) { arr.insert(Q[k][l]); } } c = *next(arr.begin(), t); if(c < min_) min_ = c; /*/* for(auto it : arr) { cout << it << " "; } cout << endl; /**/ for(j = 0; j < m - w; j++) { for(k = i; k < i + h; k++) { auto it = lower_bound(arr.begin(), arr.end(), Q[k][j]); /*/* for(auto it : arr) { cout << it << " "; } cout << endl; cout << "target : " << Q[k][j] << endl; cout << "erase : " << *it << endl; cout << "insert : " << k << ", " << j+w << endl; /**/ arr.erase(it); arr.insert(Q[k][j+w]); } /*/* for(auto it : arr) { cout << it << " "; } cout << endl; /**/ c = *next(arr.begin(), t); if(c < min_) min_ = c; //cout << "curr_min : " << min_ << endl << endl; } } return min_; }
#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...