(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #899563

#TimeUsernameProblemLanguageResultExecution timeMemory
899563LudisseyGarden (JOI23_garden)C++14
14 / 100
3054 ms8284 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int n,m,D; bool betwn(int a,int b, int x){ return ((a<=x&&x<=b)||(a<=x+D&&x+D<=b)); } void solve(){ // Input: ios::sync_with_stdio(false); cin.tie(nullptr); cin>>n>>m>>D; vector<pair<int,int>> celA(n); vector<pair<int,int>> celB(m); for (int i = 0; i < n; i++) { cin >> celA[i].first >> celA[i].second; celA[i].first%=D; celA[i].second%=D; //if(celA[i].first<=D/2) celA[i].first+=D; //if(celA[i].second<=D/2) celA[i].second+=D; } for (int i = 0; i < m; i++) { cin >> celB[i].first >> celB[i].second; celB[i].first%=D; celB[i].second%=D; //if(celB[i].first<=D/2) celB[i].first+=D; //if(celB[i].second<=D/2) celB[i].second+=D; } int ans=1e10; for (int c = 0; c <= D; c++) { for (int b = 0; b <= 2*D; b++) { for (int d = c; d <= c+D; d++) { int a=1e10; bool br=false; for (int i = 0; i < n; i++) { if(!(betwn(-D,b,celA[i].first)&&betwn(c,d,celA[i].second))) { br=true; break; } if(b>=D+celA[i].first) continue; a=min(celA[i].first,a); } if(br) continue; for (int i = 0; i < m; i++) { if(!(betwn(-D,b,celB[i].first)||betwn(c,d,celB[i].second))) { br=true; break; } if(betwn(c,d,celB[i].second)||b>=D+celB[i].first) continue; a=min(celB[i].first,a); } if(br||a==1e10) continue; ans=min(ans, ((b-a)+1)*((d-c)+1)); } } } cout << ans << "\n"; } signed main() { solve(); 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...