# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
16457 |
2015-08-25T09:31:40 Z |
jun6873 |
허수아비 (JOI14_scarecrows) |
C++ |
|
4000 ms |
2528 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
typedef struct vertex { int x,y; } vertex;
int xcomp (vertex a,vertex b) { return (a.x<b.x)?1:0; }
int ycomp (vertex a,vertex b) { return (a.y<b.y)?1:0; }
int main(void)
{
vertex strawman[200001];
int snum, res=0;
scanf ("%d", &snum);
for (int i=0; i<snum; i++) scanf("%d%d", &strawman[i].x, &strawman[i].y);
sort (strawman, strawman+snum, xcomp);
for (int i=0; i<snum; i++) strawman[i].x=i;
sort (strawman, strawman+snum, ycomp);
for (int i=0; i<snum; i++) strawman[i].y=i;
int temp;
for (int i=0;i<snum;i++) {
temp=2147483647;
for (int j=i+1;j<snum;j++) if (strawman[j].x<=temp && strawman[j].x>strawman[i].x) {
temp=strawman[j].x;
res++;
}
}
printf("%d",res);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2528 KB |
Output is correct |
2 |
Correct |
0 ms |
2528 KB |
Output is correct |
3 |
Correct |
1 ms |
2524 KB |
Output is correct |
4 |
Correct |
0 ms |
2524 KB |
Output is correct |
5 |
Correct |
0 ms |
2524 KB |
Output is correct |
6 |
Correct |
0 ms |
2520 KB |
Output is correct |
7 |
Correct |
0 ms |
2524 KB |
Output is correct |
8 |
Correct |
1 ms |
2524 KB |
Output is correct |
9 |
Correct |
0 ms |
2520 KB |
Output is correct |
10 |
Correct |
0 ms |
2524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
2524 KB |
Output is correct |
2 |
Correct |
57 ms |
2528 KB |
Output is correct |
3 |
Correct |
50 ms |
2524 KB |
Output is correct |
4 |
Correct |
15 ms |
2524 KB |
Output is correct |
5 |
Correct |
53 ms |
2524 KB |
Output is correct |
6 |
Correct |
56 ms |
2524 KB |
Output is correct |
7 |
Correct |
54 ms |
2528 KB |
Output is correct |
8 |
Correct |
20 ms |
2524 KB |
Output is correct |
9 |
Correct |
57 ms |
2528 KB |
Output is correct |
10 |
Correct |
56 ms |
2524 KB |
Output is correct |
11 |
Correct |
58 ms |
2520 KB |
Output is correct |
12 |
Correct |
36 ms |
2524 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4000 ms |
2520 KB |
Program timed out |
2 |
Halted |
0 ms |
0 KB |
- |