(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 #869646

#TimeUsernameProblemLanguageResultExecution timeMemory
869646irmuunGarden (JOI23_garden)C++17
15 / 100
3080 ms9304 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int main(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n,m,d; cin>>n>>m>>d; vector<int>p(n),q(n),r(m),s(m); vector<int>cx(d,0),cy(d,0); for(int i=0;i<n;i++){ cin>>p[i]>>q[i]; cx[p[i]]++; cy[q[i]]++; } for(int i=0;i<m;i++){ cin>>r[i]>>s[i]; } int ans=d*d; for(int i=0;i<(1<<m);i++){ for(int j=0;j<m;j++){ if(i&(1<<j)){ cx[r[j]]++; } else{ cy[s[j]]++; } } int X=0,curx=0; for(int j=0;j<2*d;j++){ if(cx[j%d]==0){ curx++; } else{ curx=0; } X=max(X,curx); } int Y=0,cury=0; for(int j=0;j<2*d;j++){ if(cy[j%d]==0){ cury++; } else{ cury=0; } Y=max(Y,cury); } ans=min(ans,(d-X)*(d-Y)); for(int j=0;j<m;j++){ if(i&(1<<j)){ cx[r[j]]--; } else{ cy[s[j]]--; } } } cout<<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...
#Verdict Execution timeMemoryGrader output
Fetching results...