Submission #16457

#TimeUsernameProblemLanguageResultExecution timeMemory
16457jun6873허수아비 (JOI14_scarecrows)C++98
15 / 100
4000 ms2528 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...