# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
200285 | 2020-02-06T04:56:20 Z | wjdqhdhfflavldkem12 | None (KOI17_cut) | C++14 | 453 ms | 44472 KB |
#include <stdio.h> #include <vector> #include <utility> #include <algorithm> #include <limits.h> using namespace std; #define LEFT 0 #define RIGHT 1 #define node pair<int, bool> int n, inX, outX; vector<node> LIST; bool compare(node a, node b){ return a.first < b.first; } int main(){ int i; scanf("%d", &n); int xtemp, ytemp, start; int minx = INT_MAX, miny = INT_MAX; vector<int> x, y; for (i = 0; i < n; i++){ scanf("%d %d", &xtemp, &ytemp); x.push_back(xtemp); y.push_back(ytemp); if (xtemp <= minx&&ytemp <= miny){ start = i; minx = xtemp; miny = ytemp; } } for (i = 0; i < start; i++){ x.push_back(x[i]); y.push_back(y[i]); } int size = 0; pair<int, int> temp; for (i = start; i < n+start-1; i++){ if (y[i]<0 && y[i + 1]>0){ size++; temp.first = i; } else if (y[i]>0 && y[i + 1] < 0){ size++; temp.second = i; if (x[temp.first] < x[temp.second]){ LIST.push_back(node(x[temp.first], LEFT)); LIST.push_back(node(x[temp.second], RIGHT)); } else{ LIST.push_back(node(x[temp.first], RIGHT)); LIST.push_back(node(x[temp.second], LEFT)); } } } sort(LIST.begin(), LIST.end(), compare); int count = 0; for (i = 0; i < size; i++){ if (LIST[i].second == LEFT){ count++; if (count == 1) outX++; } else{ count--; if (LIST[i - 1].second == LEFT) inX++; } } printf("%d %d\n", outX, inX); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 6 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 6 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 8 ms | 504 KB | Output is correct |
20 | Correct | 8 ms | 632 KB | Output is correct |
21 | Correct | 9 ms | 504 KB | Output is correct |
22 | Correct | 9 ms | 504 KB | Output is correct |
23 | Correct | 9 ms | 632 KB | Output is correct |
24 | Correct | 9 ms | 632 KB | Output is correct |
25 | Correct | 8 ms | 632 KB | Output is correct |
26 | Correct | 8 ms | 508 KB | Output is correct |
27 | Correct | 9 ms | 504 KB | Output is correct |
28 | Correct | 9 ms | 632 KB | Output is correct |
29 | Correct | 9 ms | 632 KB | Output is correct |
30 | Correct | 9 ms | 632 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 256 KB | Output is correct |
2 | Correct | 5 ms | 376 KB | Output is correct |
3 | Correct | 5 ms | 256 KB | Output is correct |
4 | Correct | 5 ms | 256 KB | Output is correct |
5 | Correct | 5 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 256 KB | Output is correct |
7 | Correct | 5 ms | 256 KB | Output is correct |
8 | Correct | 5 ms | 376 KB | Output is correct |
9 | Correct | 5 ms | 256 KB | Output is correct |
10 | Correct | 5 ms | 256 KB | Output is correct |
11 | Correct | 5 ms | 256 KB | Output is correct |
12 | Correct | 5 ms | 376 KB | Output is correct |
13 | Correct | 5 ms | 376 KB | Output is correct |
14 | Correct | 6 ms | 376 KB | Output is correct |
15 | Correct | 5 ms | 256 KB | Output is correct |
16 | Correct | 4 ms | 376 KB | Output is correct |
17 | Correct | 5 ms | 376 KB | Output is correct |
18 | Correct | 5 ms | 376 KB | Output is correct |
19 | Correct | 8 ms | 504 KB | Output is correct |
20 | Correct | 8 ms | 632 KB | Output is correct |
21 | Correct | 9 ms | 504 KB | Output is correct |
22 | Correct | 9 ms | 504 KB | Output is correct |
23 | Correct | 9 ms | 632 KB | Output is correct |
24 | Correct | 9 ms | 632 KB | Output is correct |
25 | Correct | 8 ms | 632 KB | Output is correct |
26 | Correct | 8 ms | 508 KB | Output is correct |
27 | Correct | 9 ms | 504 KB | Output is correct |
28 | Correct | 9 ms | 632 KB | Output is correct |
29 | Correct | 9 ms | 632 KB | Output is correct |
30 | Correct | 9 ms | 632 KB | Output is correct |
31 | Correct | 87 ms | 5200 KB | Output is correct |
32 | Correct | 361 ms | 20076 KB | Output is correct |
33 | Correct | 94 ms | 8824 KB | Output is correct |
34 | Correct | 320 ms | 34632 KB | Output is correct |
35 | Correct | 422 ms | 43696 KB | Output is correct |
36 | Correct | 416 ms | 44096 KB | Output is correct |
37 | Correct | 435 ms | 44336 KB | Output is correct |
38 | Correct | 430 ms | 43692 KB | Output is correct |
39 | Correct | 453 ms | 44472 KB | Output is correct |
40 | Correct | 403 ms | 40228 KB | Output is correct |
41 | Correct | 410 ms | 40244 KB | Output is correct |
42 | Correct | 414 ms | 42664 KB | Output is correct |
43 | Correct | 397 ms | 42416 KB | Output is correct |
44 | Correct | 401 ms | 42452 KB | Output is correct |
45 | Correct | 416 ms | 42660 KB | Output is correct |