Submission #595224


Source Code Expand

#include<map>
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(s...) fprintf(stderr, s)

template<class T> inline void amin(T &a, const T &b) { if (b<a) a=b; }
template<class T> inline void amax(T &a, const T &b) { if (a<b) a=b; }

int N;
map<pair<LL, LL>, int>mp;

int main() {
    scanf("%d", &N);
    REP (i, N) {
	int x, y;
	scanf("%d%d", &x, &y);
	mp[make_pair(x, y)] = i;
    }

    EACH (e, mp) EACH (f, mp) {
	if (e == f) continue;
	pair<int, int> ep = e->first;
	pair<int, int> fp = f->first;
	LL dx = fp.first - ep.first;
	LL dy = fp.second - ep.second;
	LL x[] = { ep.first - dy, fp.first - dy };
	LL y[] = { ep.second + dx, fp.second + dx };

	VI v;
	REP (i, 2) {
	    if (mp.count(make_pair(x[i], y[i]))) v.push_back(mp[make_pair(x[i], y[i])]);
	}
	if (v.size() == 2u) {
	    v.push_back(e->second);
	    v.push_back(f->second);

	    puts("4");
	    sort(v.begin(), v.end());
	    REP (i, 4) {
		printf("%d\n", v[i]+1);
	    }
	    return 0;
	}
    }

    puts("0");
    
    return 0;
}

Submission Info

Submission Time
Task C - Regular Polygon
User natsugiri
Language C++ (G++ 4.6.4)
Score 100
Code Size 1357 Byte
Status AC
Exec Time 216 ms
Memory 1176 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:24:20: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:27:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

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 29 ms 1044 KB
subtask0_sample_02.txt AC 26 ms 1048 KB
subtask1_random01.txt AC 202 ms 1172 KB
subtask1_random02.txt AC 204 ms 1072 KB
subtask1_random03.txt AC 199 ms 1164 KB
subtask1_random04.txt AC 200 ms 1176 KB
subtask1_random05.txt AC 37 ms 1172 KB
subtask1_random06.txt AC 64 ms 1172 KB
subtask1_random07.txt AC 216 ms 1072 KB
subtask1_random08.txt AC 207 ms 1072 KB
subtask1_special01.txt AC 25 ms 1004 KB
subtask1_special02.txt AC 27 ms 1048 KB
subtask1_special03.txt AC 25 ms 1048 KB
subtask1_special04.txt AC 32 ms 1044 KB
subtask1_special05.txt AC 134 ms 1072 KB
subtask1_special06.txt AC 82 ms 1076 KB
subtask1_special07.txt AC 39 ms 1072 KB
subtask1_special08.txt AC 81 ms 1168 KB
subtask1_special09.txt AC 139 ms 1072 KB
subtask1_special10.txt AC 27 ms 1172 KB