Submission #305901
Source Code Expand
#include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int N; scanf("%d", &N);
pair<pair<int,int>, int> *pts = new pair<pair<int,int>, int>[N];
for(int i = 0; i < N; ++i) {
pts[i].second = i;
scanf("%d%d", &pts[i].first.first, &pts[i].first.second);
}
sort(pts,pts+N);
bool found = false;
int ptids[4];
for(int i = 0; i < N; ++i) {
for(int j = i+1; j < N; ++j) {
int d1 = pts[j].first.second-pts[i].first.second;
int d2 = pts[i].first.first-pts[j].first.first;
pair<int,int> p2(pts[i].first.first+d1, pts[i].first.second+d2);
pair<int,int> p3(pts[j].first.first+d1, pts[j].first.second+d2);
int p2i = lower_bound(pts,pts+N,make_pair(p2,0))-pts;
int p3i = lower_bound(pts,pts+N,make_pair(p3,0))-pts;
if(p2i<N && p3i<N && pts[p2i].first == p2 && pts[p3i].first == p3) {
found = true;
ptids[0] = pts[i].second+1;
ptids[1] = pts[j].second+1;
ptids[2] = pts[p2i].second+1;
ptids[3] = pts[p3i].second+1;
}
}
}
delete[] pts;
if(found) {
sort(ptids,ptids+4);
printf("4\n%d\n%d\n%d\n%d\n", ptids[0], ptids[1], ptids[2], ptids[3]);
} else {
printf("0\n");
}
return 0;
}
Submission Info
Submission Time
2014-12-21 15:49:37+0900
Task
C - Regular Polygon
User
qnighy
Language
C++11 (GCC 4.8.1)
Score
100
Code Size
1263 Byte
Status
AC
Exec Time
106 ms
Memory
928 KB
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:6:25: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
int N; scanf("%d", &N);
^
./Main.cpp:10:61: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &pts[i].first.first, &pts[i].first.second);
^
Judge Result
Set Name
Sample
All
Score / Max Score
0 / 0
100 / 100
Status
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
23 ms
764 KB
subtask0_sample_02.txt
AC
24 ms
676 KB
subtask1_random01.txt
AC
99 ms
808 KB
subtask1_random02.txt
AC
99 ms
924 KB
subtask1_random03.txt
AC
96 ms
800 KB
subtask1_random04.txt
AC
97 ms
928 KB
subtask1_random05.txt
AC
106 ms
928 KB
subtask1_random06.txt
AC
104 ms
924 KB
subtask1_random07.txt
AC
97 ms
924 KB
subtask1_random08.txt
AC
99 ms
800 KB
subtask1_special01.txt
AC
23 ms
796 KB
subtask1_special02.txt
AC
24 ms
800 KB
subtask1_special03.txt
AC
23 ms
804 KB
subtask1_special04.txt
AC
23 ms
668 KB
subtask1_special05.txt
AC
88 ms
800 KB
subtask1_special06.txt
AC
88 ms
924 KB
subtask1_special07.txt
AC
37 ms
804 KB
subtask1_special08.txt
AC
88 ms
800 KB
subtask1_special09.txt
AC
78 ms
928 KB
subtask1_special10.txt
AC
86 ms
920 KB