Submission #526066


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long int64;

int main() {
    int n;
    int x, y;
    vector<pair<int, int> > pts;
    map<pair<int, int>, int> mp;
    cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> x >> y;
        pair<int, int> p = make_pair(x, y);
        pts.push_back(p);
        mp[p] = i;
    }
    vector<int> res;
    for(int i = 1; i < n; i++) {
        for(int j = i + 1; j <= n; j++) {
            pair<int, int> p1 = pts[i - 1], p2 = pts[j - 1];
            int x1 = p1.first, y1 = p1.second, x2 = p2.first, y2 = p2.second;
            int x3 = (x1 + x2 - y2 + y1) >> 1, y3 = (y1 + y2 + x2 - x1) >> 1;
            int x4 = (x1 + x2 + y2 - y1) >> 1, y4 = (y1 + y2 - x2 + x1) >> 1;
            pair<int, int> p3 = make_pair(x3, y3), p4 = make_pair(x4, y4);
            if(mp.count(p3) && mp.count(p4)) {
                res.push_back(i);
                res.push_back(j);
                res.push_back(mp[p3]);
                res.push_back(mp[p4]);
                cout << "4" << endl;
                sort(res.begin(), res.end());
                for(int k = 0; k < 4; k++) {
                    cout << res[k] << endl;
                }
                return 0;
            }
        }
    }
    cout << "0" << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Regular Polygon
User daisy8867
Language C++ (G++ 4.6.4)
Score 100
Code Size 1329 Byte
Status AC
Exec Time 82 ms
Memory 1056 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 20
Set Name Test Cases
Sample subtask0_sample_01.txt, subtask0_sample_02.txt
All subtask0_sample_01.txt, subtask0_sample_02.txt, subtask1_random01.txt, subtask1_random02.txt, subtask1_random03.txt, subtask1_random04.txt, subtask1_random05.txt, subtask1_random06.txt, subtask1_random07.txt, subtask1_random08.txt, subtask1_special01.txt, subtask1_special02.txt, subtask1_special03.txt, subtask1_special04.txt, subtask1_special05.txt, subtask1_special06.txt, subtask1_special07.txt, subtask1_special08.txt, subtask1_special09.txt, subtask1_special10.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 27 ms 924 KB
subtask0_sample_02.txt AC 24 ms 924 KB
subtask1_random01.txt AC 77 ms 948 KB
subtask1_random02.txt AC 82 ms 1048 KB
subtask1_random03.txt AC 77 ms 940 KB
subtask1_random04.txt AC 76 ms 948 KB
subtask1_random05.txt AC 28 ms 948 KB
subtask1_random06.txt AC 30 ms 1056 KB
subtask1_random07.txt AC 75 ms 944 KB
subtask1_random08.txt AC 77 ms 860 KB
subtask1_special01.txt AC 28 ms 920 KB
subtask1_special02.txt AC 24 ms 924 KB
subtask1_special03.txt AC 25 ms 928 KB
subtask1_special04.txt AC 28 ms 916 KB
subtask1_special05.txt AC 44 ms 992 KB
subtask1_special06.txt AC 32 ms 1052 KB
subtask1_special07.txt AC 28 ms 928 KB
subtask1_special08.txt AC 31 ms 1044 KB
subtask1_special09.txt AC 52 ms 944 KB
subtask1_special10.txt AC 30 ms 1048 KB