Submission #1928209


Source Code Expand

// {{{
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

using namespace std;

typedef long int i32;
typedef unsigned long int u32;
typedef long long int i64;
typedef unsigned long long int  u64;
typedef pair<i32, i32> PII;
typedef vector<i32> VI;
typedef vector<string> VS;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef map<i32, i32> MPII;
typedef set<i32> SETI;
typedef multiset<i32> MSETI;
#define IN(x) cin >> x;
#define SCD(t) scanf("%d",&t)
#define SCLD(t) scanf("%ld",&t)
#define SCLLD(t) scanf("%lld",&t)
#define SCC(t) scanf("%c",&t)
#define SCS(t) scanf("%s",t)
#define SCF(t) scanf("%f",&t)
#define SCLF(t) scanf("%lf",&t)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ZERO(a) memset(a, 0, sizeof(a))
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define BTW(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define PF push_front
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;

template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
// }}}

int main() {
    int N, K;
    IN(N);IN(K);
    auto xys = vector<PII>(N);;
    REP(i, N) {
        IN(xys[i].first);IN(xys[i].second);
    }
    u64 ans = (u64)-1;
    REP(i, N)REP(j, N)REP(k, N)REP(l, N) {
        i32 x1, x2, y1, y2;
        x1 = x2 = xys[i].first;
        y1 = y2 = xys[i].second;
        amax(x1, xys[j].first);
        amax(x1, xys[k].first);
        amax(x1, xys[l].first);
        amin(x2, xys[j].first);
        amin(x2, xys[k].first);
        amin(x2, xys[l].first);
        amax(y1, xys[j].second);
        amax(y1, xys[k].second);
        amax(y1, xys[l].second);
        amin(y2, xys[j].second);
        amin(y2, xys[k].second);
        amin(y2, xys[l].second);
        u32 counter = 0;
        REP(m, N) {
            auto x = xys[m].first;
            auto y = xys[m].second;
            if((x1-x)*(x2-x) <= 0 && (y1-y)*(y2-y) <= 0) {
                counter++;
            }
        }
        if(counter >= K) {
            u64 area = (x1-x2) * (y1-y2);
            amin(ans, area);
        }
    }
    cout << ans << endl;
    return 0;
}

Submission Info

Submission Time
Task D - Axis-Parallel Rectangle
User kotarou
Language C++14 (GCC 5.4.1)
Score 400
Code Size 3059 Byte
Status AC
Exec Time 634 ms
Memory 256 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 27
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_1.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_2.txt, subtask_1_20.txt, subtask_1_21.txt, subtask_1_22.txt, subtask_1_23.txt, subtask_1_24.txt, subtask_1_3.txt, subtask_1_4.txt, subtask_1_5.txt, subtask_1_6.txt, subtask_1_7.txt, subtask_1_8.txt, subtask_1_9.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KiB
sample_02.txt AC 1 ms 256 KiB
sample_03.txt AC 1 ms 256 KiB
subtask_1_1.txt AC 10 ms 256 KiB
subtask_1_10.txt AC 63 ms 256 KiB
subtask_1_11.txt AC 1 ms 256 KiB
subtask_1_12.txt AC 12 ms 256 KiB
subtask_1_13.txt AC 16 ms 256 KiB
subtask_1_14.txt AC 1 ms 256 KiB
subtask_1_15.txt AC 2 ms 256 KiB
subtask_1_16.txt AC 629 ms 256 KiB
subtask_1_17.txt AC 629 ms 256 KiB
subtask_1_18.txt AC 634 ms 256 KiB
subtask_1_19.txt AC 634 ms 256 KiB
subtask_1_2.txt AC 7 ms 256 KiB
subtask_1_20.txt AC 618 ms 256 KiB
subtask_1_21.txt AC 1 ms 256 KiB
subtask_1_22.txt AC 22 ms 256 KiB
subtask_1_23.txt AC 618 ms 256 KiB
subtask_1_24.txt AC 606 ms 256 KiB
subtask_1_3.txt AC 4 ms 256 KiB
subtask_1_4.txt AC 275 ms 256 KiB
subtask_1_5.txt AC 569 ms 256 KiB
subtask_1_6.txt AC 167 ms 256 KiB
subtask_1_7.txt AC 125 ms 256 KiB
subtask_1_8.txt AC 99 ms 256 KiB
subtask_1_9.txt AC 413 ms 256 KiB