Submission #527693


Source Code Expand

/*{{{*/
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <functional>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
typedef int8_t sbyte;
typedef uint8_t byte;
typedef uint16_t ushort;
typedef uint32_t uint;
typedef int64_t i64;
typedef uint64_t u64;
template<class T> static inline T ABS(T x) {return x < 0 ? -x : x;}
template<class T> static inline void MAZ(T &a, const T &b) {if(a < b) a = b;}
template<class T> static inline void MIZ(T &a, const T &b) {if(b < a) a = b;}
/*}}}*/

map<pair<i64, i64>, int> M;

int main() {
	int N;
	scanf("%d", &N);
	for(int i = 0; i < N; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		M.emplace(make_pair(x * 2LL, y * 2LL), i + 1);
	}
	for(auto it = M.begin(); it != M.end(); ++it) {
		auto p1 = it->first;
		for(auto jt = it; ++jt != M.end(); ) {
			auto p2 = jt->first;
			auto hp12 = make_pair((p2.first - p1.first) / 2, (p2.second - p1.second) / 2);
			auto c = make_pair(p1.first + hp12.first, p1.second + hp12.second);
			auto p3 = make_pair(c.first + hp12.second, c.second - hp12.first);
			auto it3 = M.find(p3);
			if(it3 == M.end()) continue;
			auto p4 = make_pair(c.first - hp12.second, c.second + hp12.first);
			auto it4 = M.find(p4);
			if(it4 == M.end()) continue;
			puts("4");
			vector<int> v {it->second, jt->second, it3->second, it4->second};
			sort(begin(v), end(v));
			for(auto i : v) printf("%d\n", i);
			exit(0);
		}
	}
	puts("0");
	return 0;
}

Submission Info

Submission Time
Task C - Regular Polygon
User arosusti
Language C++11 (GCC 4.8.1)
Score 100
Code Size 1819 Byte
Status AC
Exec Time 91 ms
Memory 1108 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:41:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
                 ^
./Main.cpp:44:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &x, &y);
                        ^

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 28 ms 1048 KB
subtask0_sample_02.txt AC 29 ms 1044 KB
subtask1_random01.txt AC 91 ms 984 KB
subtask1_random02.txt AC 88 ms 1068 KB
subtask1_random03.txt AC 86 ms 984 KB
subtask1_random04.txt AC 85 ms 1052 KB
subtask1_random05.txt AC 38 ms 1044 KB
subtask1_random06.txt AC 54 ms 988 KB
subtask1_random07.txt AC 90 ms 1052 KB
subtask1_random08.txt AC 90 ms 1052 KB
subtask1_special01.txt AC 32 ms 924 KB
subtask1_special02.txt AC 27 ms 916 KB
subtask1_special03.txt AC 27 ms 988 KB
subtask1_special04.txt AC 29 ms 1020 KB
subtask1_special05.txt AC 70 ms 1060 KB
subtask1_special06.txt AC 63 ms 1108 KB
subtask1_special07.txt AC 40 ms 988 KB
subtask1_special08.txt AC 63 ms 1048 KB
subtask1_special09.txt AC 74 ms 1044 KB
subtask1_special10.txt AC 33 ms 1044 KB