# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27803 | 2017-07-14T06:41:57 Z | 김동현(#1158) | Cultivation (JOI17_cultivation) | C++14 | 163 ms | 262144 KB |
#include <bits/stdc++.h> using namespace std; const int inf = 2e9; int r, c, n, x[301], y[301], a[101][101], s[101][101], ans = inf; vector<int> xv, yv; int can(int X, int Y){ X++; Y++; for(int i = 1; i <= 100; i++) fill(a[i] + 1, a[i] + 101, 0); for(int i = 1; i <= n; i++){ a[x[i]][y[i]]++; a[x[i] + X][y[i]]--; a[x[i]][y[i] + Y]--; a[x[i] + X][y[i] + Y]++; } for(int i = 1; i <= 100; i++){ for(int j = 1; j <= 100; j++){ a[i][j] += a[i - 1][j]; } } for(int i = 1; i <= 100; i++){ for(int j = 1; j <= 100; j++){ a[i][j] += a[i][j - 1]; s[i][j] = s[i - 1][j] + s[i][j - 1] - s[i - 1][j - 1] + !!(a[i][j]); } } for(int i = 0; i < r; i++){ for(int j = 0; j < c; j++){ if(s[i + r][j + c] - s[i + r][j] - s[i][j + c] + s[i][j] == r * c) return 1; } } return 0; } int main(){ scanf("%d%d%d", &r, &c, &n); for(int i = 1; i <= n; i++){ scanf("%d%d", x + i, y + i); } for(int i = 0; i < r; i++) xv.push_back(i); for(int i = 0; i < c; i++) yv.push_back(i); for(int i = 0; i < xv.size(); i++){ for(int j = 0; j < yv.size(); j++){ if(can(xv[i], yv[j])) ans = min(ans, xv[i] + yv[j]); } } printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2100 KB | Output is correct |
2 | Correct | 0 ms | 2100 KB | Output is correct |
3 | Correct | 0 ms | 2100 KB | Output is correct |
4 | Correct | 0 ms | 2100 KB | Output is correct |
5 | Correct | 0 ms | 2100 KB | Output is correct |
6 | Correct | 0 ms | 2100 KB | Output is correct |
7 | Correct | 0 ms | 2100 KB | Output is correct |
8 | Correct | 0 ms | 2100 KB | Output is correct |
9 | Correct | 0 ms | 2100 KB | Output is correct |
10 | Correct | 0 ms | 2100 KB | Output is correct |
11 | Correct | 0 ms | 2100 KB | Output is correct |
12 | Correct | 0 ms | 2100 KB | Output is correct |
13 | Correct | 0 ms | 2100 KB | Output is correct |
14 | Correct | 0 ms | 2100 KB | Output is correct |
15 | Correct | 0 ms | 2100 KB | Output is correct |
16 | Correct | 0 ms | 2100 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2100 KB | Output is correct |
2 | Correct | 0 ms | 2100 KB | Output is correct |
3 | Correct | 0 ms | 2100 KB | Output is correct |
4 | Correct | 0 ms | 2100 KB | Output is correct |
5 | Correct | 0 ms | 2100 KB | Output is correct |
6 | Correct | 0 ms | 2100 KB | Output is correct |
7 | Correct | 0 ms | 2100 KB | Output is correct |
8 | Correct | 0 ms | 2100 KB | Output is correct |
9 | Correct | 0 ms | 2100 KB | Output is correct |
10 | Correct | 0 ms | 2100 KB | Output is correct |
11 | Correct | 0 ms | 2100 KB | Output is correct |
12 | Correct | 0 ms | 2100 KB | Output is correct |
13 | Correct | 0 ms | 2100 KB | Output is correct |
14 | Correct | 0 ms | 2100 KB | Output is correct |
15 | Correct | 0 ms | 2100 KB | Output is correct |
16 | Correct | 0 ms | 2100 KB | Output is correct |
17 | Correct | 9 ms | 2100 KB | Output is correct |
18 | Correct | 33 ms | 2100 KB | Output is correct |
19 | Correct | 69 ms | 2100 KB | Output is correct |
20 | Correct | 19 ms | 2100 KB | Output is correct |
21 | Incorrect | 59 ms | 2100 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2100 KB | Output is correct |
2 | Correct | 0 ms | 2100 KB | Output is correct |
3 | Correct | 0 ms | 2100 KB | Output is correct |
4 | Correct | 0 ms | 2100 KB | Output is correct |
5 | Correct | 0 ms | 2100 KB | Output is correct |
6 | Correct | 0 ms | 2100 KB | Output is correct |
7 | Correct | 0 ms | 2100 KB | Output is correct |
8 | Correct | 0 ms | 2100 KB | Output is correct |
9 | Correct | 0 ms | 2100 KB | Output is correct |
10 | Correct | 0 ms | 2100 KB | Output is correct |
11 | Correct | 0 ms | 2100 KB | Output is correct |
12 | Correct | 0 ms | 2100 KB | Output is correct |
13 | Correct | 0 ms | 2100 KB | Output is correct |
14 | Correct | 0 ms | 2100 KB | Output is correct |
15 | Correct | 0 ms | 2100 KB | Output is correct |
16 | Correct | 0 ms | 2100 KB | Output is correct |
17 | Correct | 9 ms | 2100 KB | Output is correct |
18 | Correct | 33 ms | 2100 KB | Output is correct |
19 | Correct | 69 ms | 2100 KB | Output is correct |
20 | Correct | 19 ms | 2100 KB | Output is correct |
21 | Incorrect | 59 ms | 2100 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 163 ms | 262144 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 163 ms | 262144 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2100 KB | Output is correct |
2 | Correct | 0 ms | 2100 KB | Output is correct |
3 | Correct | 0 ms | 2100 KB | Output is correct |
4 | Correct | 0 ms | 2100 KB | Output is correct |
5 | Correct | 0 ms | 2100 KB | Output is correct |
6 | Correct | 0 ms | 2100 KB | Output is correct |
7 | Correct | 0 ms | 2100 KB | Output is correct |
8 | Correct | 0 ms | 2100 KB | Output is correct |
9 | Correct | 0 ms | 2100 KB | Output is correct |
10 | Correct | 0 ms | 2100 KB | Output is correct |
11 | Correct | 0 ms | 2100 KB | Output is correct |
12 | Correct | 0 ms | 2100 KB | Output is correct |
13 | Correct | 0 ms | 2100 KB | Output is correct |
14 | Correct | 0 ms | 2100 KB | Output is correct |
15 | Correct | 0 ms | 2100 KB | Output is correct |
16 | Correct | 0 ms | 2100 KB | Output is correct |
17 | Correct | 9 ms | 2100 KB | Output is correct |
18 | Correct | 33 ms | 2100 KB | Output is correct |
19 | Correct | 69 ms | 2100 KB | Output is correct |
20 | Correct | 19 ms | 2100 KB | Output is correct |
21 | Incorrect | 59 ms | 2100 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |