제출 #95972

#제출 시각아이디문제언어결과실행 시간메모리
95972SuperJavaPyramid Base (IOI08_pyramid_base)C++17
15 / 100
15 ms5240 KiB
//fold #ifndef KHALIL #include <bits/stdc++.h> #else #include "header.h" #endif #define endl '\n' #define mp make_pair #define tostr(x) static_cast<ostringstream&>((ostringstream()<<dec<<x)).str() #define rep(i,begin,end) for(auto i = begin;i < end;i++) #define repr(i,begin,end) for(auto i = begin-1;i >= end;i--) #define pb push_back #define sz(a) ((int)(a).size()) #define fi first #define se second #define abs(a) ((a) < (0) ? (-1)*(a) : (a)) #define SQ(a) ((a)*(a)) #define eqd(a,b) (abs(a-b)<1e-9) #define X real() #define Y imag() using namespace std; typedef long long ll; typedef long double ld; template <typename t> t in(t q){cin >> q;return q;} template <typename T> ostream& operator<<(ostream& os, const vector<T>& v){os << "[";for (int i = 0; i < sz(v); ++i) { os << v[i]; if (i != sz(v) - 1) os << ",";}os << "]";return os;} template <typename T, typename S>ostream& operator<<(ostream& os, const map<T, S>& v){for (auto it : v)os << "(" << it.first << ":" << it.second << ")";return os;} template <typename T, typename S>ostream& operator<<(ostream& os, const pair<T, S>& v){os << "(" << v.first << "," << v.second << ")";return os;} const long double PI = acosl(-1); mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count()); inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);} inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);} //endfold #define N (1005) #define MOD (1000000000l + 7l) #define OO (1050000000) #define OOL (1100000000000000000) //global int n,m; bool a[N][N]; int p[N][N]; bool test(int s){ for(int i = 1;i <= m-s+1;i++){ for(int j = 1;j <= n-s+1;j++){ if(p[i+s-1][j+s-1]-p[i-1][j+s-1]-p[i+s-1][j-1]+p[i-1][j-1] == 0) return true; } } return false; } int main(){ //fold ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << setprecision(10); //endfold cin >> m >> n; int b; cin >> b; int q; cin >> q; while(q--){ int x1,y1,x2,y2,c; cin >> x1 >> y1 >> x2 >> y2 >> c; if(x1 > x2) swap(x1,x2); if(y1 > y2) swap(y1,y2); rep(i,x1,x2+1){ rep(j,y1,y2+1){ a[i][j] = true; } } } rep(j,1,n+1){ rep(i,1,m+1){ p[i][j] = p[i-1][j]+p[i][j-1]-p[i-1][j-1]+a[i][j]; } } // repr(i,10,1){ // rep(j,1,7){ // cout << p[j][i] << " "; // }cout << endl; // } // cout << endl; int l = 1,r = 1000,best = 0; while(l <= r){ int mid = (l+r)/2; if(test(mid)){ best = mid; l = mid+1; }else{ r = mid-1; } } cout << best; return 0; }
#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...
#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...
#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...