# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
46510 | 2018-04-21T08:35:56 Z | ikura355 | Cultivation (JOI17_cultivation) | C++14 | 504 ms | 1128 KB |
//30 pts. #include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define X first #define Y second const int maxn = 300 + 5; const int inf = 1e9; int n,R,C; pii p[maxn]; vector<int> have[45]; int main() { scanf("%d%d%d",&R,&C,&n); for(int i=1;i<=n;i++) scanf("%d%d",&p[i].X,&p[i].Y); //fix up and down (R<=40) int ans = inf; for(int up=0;up<=R;up++) { for(int down=0;down<=R;down++) { for(int row=1;row<=R;row++) have[row].clear(); for(int x=1;x<=n;x++) { for(int i=max(1,p[x].X-up);i<=min(R,p[x].X+down);i++) { have[i].push_back(p[x].Y); } } for(int row=1;row<=R;row++) sort(have[row].begin(), have[row].end()); int left = 0, right = 0, gap = 0, bad = 0; for(int row=1;row<=R;row++) { if(have[row].size()==0) { bad = 1; break; } left = max(left, *have[row].begin()-1); right = max(right, C-*have[row].rbegin()); } for(int row=1;row<=R;row++) { for(int i=1;i<have[row].size();i++) gap = max(gap, have[row][i]-have[row][i-1]-1-left-right); } if(!bad) ans = min(ans, up + down + left + right + gap); // printf("up = %d down = %d : use %d %d %d\n",up,down,left,right,gap); } } printf("%d",ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 608 KB | Output is correct |
8 | Correct | 2 ms | 608 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 2 ms | 704 KB | Output is correct |
11 | Correct | 2 ms | 704 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 704 KB | Output is correct |
14 | Correct | 2 ms | 704 KB | Output is correct |
15 | Correct | 2 ms | 704 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 608 KB | Output is correct |
8 | Correct | 2 ms | 608 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 2 ms | 704 KB | Output is correct |
11 | Correct | 2 ms | 704 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 704 KB | Output is correct |
14 | Correct | 2 ms | 704 KB | Output is correct |
15 | Correct | 2 ms | 704 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 3 ms | 740 KB | Output is correct |
18 | Correct | 14 ms | 744 KB | Output is correct |
19 | Correct | 12 ms | 780 KB | Output is correct |
20 | Correct | 2 ms | 784 KB | Output is correct |
21 | Correct | 31 ms | 788 KB | Output is correct |
22 | Correct | 127 ms | 792 KB | Output is correct |
23 | Correct | 18 ms | 796 KB | Output is correct |
24 | Correct | 264 ms | 936 KB | Output is correct |
25 | Correct | 201 ms | 936 KB | Output is correct |
26 | Correct | 460 ms | 940 KB | Output is correct |
27 | Correct | 433 ms | 964 KB | Output is correct |
28 | Correct | 256 ms | 1080 KB | Output is correct |
29 | Correct | 370 ms | 1080 KB | Output is correct |
30 | Correct | 442 ms | 1080 KB | Output is correct |
31 | Correct | 438 ms | 1080 KB | Output is correct |
32 | Correct | 455 ms | 1080 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 608 KB | Output is correct |
8 | Correct | 2 ms | 608 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 2 ms | 704 KB | Output is correct |
11 | Correct | 2 ms | 704 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 704 KB | Output is correct |
14 | Correct | 2 ms | 704 KB | Output is correct |
15 | Correct | 2 ms | 704 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 3 ms | 740 KB | Output is correct |
18 | Correct | 14 ms | 744 KB | Output is correct |
19 | Correct | 12 ms | 780 KB | Output is correct |
20 | Correct | 2 ms | 784 KB | Output is correct |
21 | Correct | 31 ms | 788 KB | Output is correct |
22 | Correct | 127 ms | 792 KB | Output is correct |
23 | Correct | 18 ms | 796 KB | Output is correct |
24 | Correct | 264 ms | 936 KB | Output is correct |
25 | Correct | 201 ms | 936 KB | Output is correct |
26 | Correct | 460 ms | 940 KB | Output is correct |
27 | Correct | 433 ms | 964 KB | Output is correct |
28 | Correct | 256 ms | 1080 KB | Output is correct |
29 | Correct | 370 ms | 1080 KB | Output is correct |
30 | Correct | 442 ms | 1080 KB | Output is correct |
31 | Correct | 438 ms | 1080 KB | Output is correct |
32 | Correct | 455 ms | 1080 KB | Output is correct |
33 | Correct | 2 ms | 1080 KB | Output is correct |
34 | Correct | 487 ms | 1080 KB | Output is correct |
35 | Correct | 456 ms | 1080 KB | Output is correct |
36 | Correct | 482 ms | 1080 KB | Output is correct |
37 | Correct | 320 ms | 1080 KB | Output is correct |
38 | Correct | 479 ms | 1080 KB | Output is correct |
39 | Correct | 443 ms | 1080 KB | Output is correct |
40 | Correct | 504 ms | 1128 KB | Output is correct |
41 | Correct | 270 ms | 1128 KB | Output is correct |
42 | Correct | 347 ms | 1128 KB | Output is correct |
43 | Correct | 443 ms | 1128 KB | Output is correct |
44 | Correct | 465 ms | 1128 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1128 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 1128 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 248 KB | Output is correct |
2 | Correct | 2 ms | 356 KB | Output is correct |
3 | Correct | 2 ms | 560 KB | Output is correct |
4 | Correct | 2 ms | 560 KB | Output is correct |
5 | Correct | 2 ms | 560 KB | Output is correct |
6 | Correct | 2 ms | 560 KB | Output is correct |
7 | Correct | 2 ms | 608 KB | Output is correct |
8 | Correct | 2 ms | 608 KB | Output is correct |
9 | Correct | 2 ms | 648 KB | Output is correct |
10 | Correct | 2 ms | 704 KB | Output is correct |
11 | Correct | 2 ms | 704 KB | Output is correct |
12 | Correct | 2 ms | 704 KB | Output is correct |
13 | Correct | 2 ms | 704 KB | Output is correct |
14 | Correct | 2 ms | 704 KB | Output is correct |
15 | Correct | 2 ms | 704 KB | Output is correct |
16 | Correct | 2 ms | 704 KB | Output is correct |
17 | Correct | 3 ms | 740 KB | Output is correct |
18 | Correct | 14 ms | 744 KB | Output is correct |
19 | Correct | 12 ms | 780 KB | Output is correct |
20 | Correct | 2 ms | 784 KB | Output is correct |
21 | Correct | 31 ms | 788 KB | Output is correct |
22 | Correct | 127 ms | 792 KB | Output is correct |
23 | Correct | 18 ms | 796 KB | Output is correct |
24 | Correct | 264 ms | 936 KB | Output is correct |
25 | Correct | 201 ms | 936 KB | Output is correct |
26 | Correct | 460 ms | 940 KB | Output is correct |
27 | Correct | 433 ms | 964 KB | Output is correct |
28 | Correct | 256 ms | 1080 KB | Output is correct |
29 | Correct | 370 ms | 1080 KB | Output is correct |
30 | Correct | 442 ms | 1080 KB | Output is correct |
31 | Correct | 438 ms | 1080 KB | Output is correct |
32 | Correct | 455 ms | 1080 KB | Output is correct |
33 | Correct | 2 ms | 1080 KB | Output is correct |
34 | Correct | 487 ms | 1080 KB | Output is correct |
35 | Correct | 456 ms | 1080 KB | Output is correct |
36 | Correct | 482 ms | 1080 KB | Output is correct |
37 | Correct | 320 ms | 1080 KB | Output is correct |
38 | Correct | 479 ms | 1080 KB | Output is correct |
39 | Correct | 443 ms | 1080 KB | Output is correct |
40 | Correct | 504 ms | 1128 KB | Output is correct |
41 | Correct | 270 ms | 1128 KB | Output is correct |
42 | Correct | 347 ms | 1128 KB | Output is correct |
43 | Correct | 443 ms | 1128 KB | Output is correct |
44 | Correct | 465 ms | 1128 KB | Output is correct |
45 | Runtime error | 2 ms | 1128 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
46 | Halted | 0 ms | 0 KB | - |