Submission #815762

#TimeUsernameProblemLanguageResultExecution timeMemory
815762beaconmcGarden (JOI23_garden)C++14
0 / 100
3089 ms52924 KiB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

typedef long long ll;
using namespace std;
//using namespace __gnu_pbds;

#define FOR(i, x, y) for(ll i=x; i<y; i++)
#define FORNEG(i, x, y) for(ll i=x; i>y; i--)
//#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)


int main(){
    fast();
    ll n,m,d;
    cin >> n >> m >> d;
    vector<vector<ll>> a,b;

    FOR(i,0,n){
      vector<ll> temp(2);
      cin >> temp[0] >> temp[1];
      a.push_back(temp);
    }

    FOR(i,0,m){
      vector<ll> temp(2);
      cin >> temp[0] >> temp[1];
      b.push_back(temp);
    }

    vector<ll> X;
    vector<ll> Y;

    for (auto&i : a){
      X.push_back(i[0]);
      Y.push_back(i[1]);

    }
    ll ans = 1000000000000;

    FOR(i,0,1<<(b.size())){
      vector<ll> x,y;
      x = X;
      y = Y;
      FOR(j,0,b.size()){
        if (i&(1<<j)){
          x.push_back(b[j][0]);
        }else{
          y.push_back(b[j][1]);
        }
      }
      sort(x.begin(), x.end());
      sort(y.begin(), y.end());

      ll xx = 1000000000000;
      ll yy = 1000000000000;

      FOR(i,0,x.size()-1){
        xx = min(xx, d-(x[i+1]-x[i])+1);

      }
      xx = min(xx, x[x.size()-1]-x[0]+1);

      FOR(i,0,y.size()-1){
        yy = min(yy, d-(y[i+1]-y[i])+1);
      }
      yy = min(yy, y[y.size()-1]-y[0]+1);
      ans = min(ans, xx*yy);
    }
    cout << ans;

}














Compilation message (stderr)

garden.cpp: In function 'int main()':
garden.cpp:9:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   47 |       FOR(j,0,b.size()){
      |           ~~~~~~~~~~~~             
garden.cpp:47:7: note: in expansion of macro 'FOR'
   47 |       FOR(j,0,b.size()){
      |       ^~~
garden.cpp:9:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   60 |       FOR(i,0,x.size()-1){
      |           ~~~~~~~~~~~~~~           
garden.cpp:60:7: note: in expansion of macro 'FOR'
   60 |       FOR(i,0,x.size()-1){
      |       ^~~
garden.cpp:9:35: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 | #define FOR(i, x, y) for(ll i=x; i<y; i++)
......
   66 |       FOR(i,0,y.size()-1){
      |           ~~~~~~~~~~~~~~           
garden.cpp:66:7: note: in expansion of macro 'FOR'
   66 |       FOR(i,0,y.size()-1){
      |       ^~~
#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...