제출 #965416

#제출 시각아이디문제언어결과실행 시간메모리
965416hirayuu_oj삶의 질 (IOI10_quality)C++17
100 / 100
1744 ms140412 KiB
#include "quality.h" #include<bits/stdc++.h> using namespace std; #define rep(i,n) for(int i=0; i<(n); i++) #define all(x) x.begin(),x.end(); using ll=long long; const ll INF=1LL<<60; int rectangle(int R, int C, int H, int W, int Q[3001][3001]) { vector<vector<int>> cum(R+1,vector<int>(C+1,0)); int ok=R*C,ng=0; while(ok-ng>1){ int mid=(ok+ng)/2; rep(i,R+1){ cum[i][0]=0; } rep(i,C+1){ cum[0][i]=0; } rep(i,R){ rep(j,C){ cum[i+1][j+1]=cum[i+1][j]+cum[i][j+1]-cum[i][j]; if(Q[i][j]<=mid)cum[i+1][j+1]++; } } bool can=false; rep(i,R-H+1){ rep(j,C-W+1){ int val=cum[i+H][j+W]-cum[i+H][j]-cum[i][j+W]+cum[i][j]; if(val>=H*W-val)can=true; } } if(can)ok=mid; else ng=mid; } return ok; } //g++ -o quality -O2 quality.cpp grader.cpp
#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...