Submission #16456

# Submission time Handle Problem Language Result Execution time Memory
16456 2015-08-25T09:27:57 Z jun6873 허수아비 (JOI14_scarecrows) C++
15 / 100
56 ms 1744 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[100001];
    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 1744 KB Output is correct
2 Correct 0 ms 1744 KB Output is correct
3 Correct 0 ms 1740 KB Output is correct
4 Correct 0 ms 1744 KB Output is correct
5 Correct 0 ms 1740 KB Output is correct
6 Correct 1 ms 1744 KB Output is correct
7 Correct 0 ms 1740 KB Output is correct
8 Correct 0 ms 1740 KB Output is correct
9 Correct 0 ms 1740 KB Output is correct
10 Correct 0 ms 1740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 1740 KB Output is correct
2 Correct 54 ms 1744 KB Output is correct
3 Correct 50 ms 1744 KB Output is correct
4 Correct 15 ms 1744 KB Output is correct
5 Correct 53 ms 1744 KB Output is correct
6 Correct 54 ms 1740 KB Output is correct
7 Correct 50 ms 1744 KB Output is correct
8 Correct 22 ms 1740 KB Output is correct
9 Correct 56 ms 1744 KB Output is correct
10 Correct 56 ms 1740 KB Output is correct
11 Correct 50 ms 1740 KB Output is correct
12 Correct 37 ms 1744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 37 ms 1736 KB SIGSEGV Segmentation fault
2 Halted 0 ms 0 KB -