Submission #7588807


Source Code Expand

Copy
#include<bits/stdc++.h>
using namespace std;
using pii = std::pair<int,int>;
auto addp(pii a, pii b){ return make_pair(a.first + b.first, a.second + b.second);}
signed main(){
    int N;
    cin >> N;
    std::vector<pii>v(N);
    map<pii,int>mp;
    for(auto & p : v)
        std:: cin >> p.first >> p.second;
    sort(v.begin(),v.end());
    for(auto p : v)mp[p]++;
    int ans = N;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < N; ++j){
            if(i == j)continue;
            auto t = mp;
            auto mt = t;
            int x_dif = v[i].first - v[j].first;
            int y_dif = v[i].second - v[j].second;
            for(int k = 0; k < N; ++k){
                if(k == i or k == j) continue;
                auto pp = addp(v[k],make_pair(x_dif,y_dif));
                auto np = addp(v[k],make_pair(-1*x_dif, -1*y_dif));
                if(t[pp] > 0) t[v[k]]--;
                if(mt[np] > 0) mt[v[k]]--;
            }
            int tans = -1, mtans = -1;
            for(auto itr :t) tans += itr.second;
            for(auto itr : mt) mtans += itr.second;
            ans = min({ans,tans,mtans});
            
        }
    }
    cout << ans << endl;
}

Submission Info

Submission Time
Task B - Picking Up
User yebityon
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1223 Byte
Status
Exec Time 35 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 s1.txt, s2.txt, s3.txt
All 300 / 300 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, s1.txt, s2.txt, s3.txt
Case Name Status Exec Time Memory
01.txt 1 ms 256 KB
02.txt 1 ms 256 KB
03.txt 34 ms 256 KB
04.txt 34 ms 256 KB
05.txt 27 ms 256 KB
06.txt 27 ms 256 KB
07.txt 25 ms 256 KB
08.txt 10 ms 256 KB
09.txt 27 ms 256 KB
10.txt 25 ms 256 KB
11.txt 35 ms 256 KB
12.txt 34 ms 256 KB
13.txt 35 ms 256 KB
14.txt 31 ms 256 KB
15.txt 32 ms 256 KB
16.txt 33 ms 256 KB
17.txt 32 ms 256 KB
18.txt 33 ms 256 KB
19.txt 33 ms 256 KB
20.txt 33 ms 256 KB
s1.txt 1 ms 256 KB
s2.txt 1 ms 256 KB
s3.txt 1 ms 256 KB