# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
168705 | 2019-12-15T11:37:58 Z | ho94949 | Cultivation (JOI17_cultivation) | C++17 | 863 ms | 508 KB |
#include<bits/stdc++.h> using namespace std; uint64_t B[40]; int main() { int R, C, N; scanf("%d%d%d", &R, &C, &N); for(int i=0; i<N; ++i) { int u, v; scanf("%d%d", &u, &v); B[u-1] |= (1ull<<(v-1)); } int ans = 202020; for(int w=0; w<C; ++w) for(int e=0; e<C; ++e) for(int n=0; n<R; ++n) for(int s=0; s<R; ++s) { if(w+e>=C || n+s>=R) continue; uint64_t A[40]; memcpy(A, B, sizeof A); for(int i=0; i<w; ++i) for(int j=0; j<R; ++j) A[j] |= A[j]>>1; for(int i=0; i<e; ++i) for(int j=0; j<R; ++j) A[j] |= A[j]<<1; for(int i=0; i<n; ++i) for(int j=0; j<R-1; ++j) A[j] |= A[j+1]; for(int i=0; i<s; ++i) for(int j=R-2; j>=0; --j) A[j+1] |= A[j]; uint64_t tar = (1ull<<C)-1; /* printf("%d %d %d %d\n", w, e, n, s); for(int i=0; i<R; ++i,puts("")) for(int j=0; j<C; ++j) printf("%d", !!(A[i]&(1<<j)));*/ for(int i=0; i<R; ++i) tar &= A[i]; if(tar == (1ull<<C)-1) ans = min(ans, w+e+n+s); } printf("%d\n", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 78 ms | 376 KB | Output is correct |
19 | Correct | 863 ms | 352 KB | Output is correct |
20 | Correct | 18 ms | 508 KB | Output is correct |
21 | Incorrect | 665 ms | 256 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 78 ms | 376 KB | Output is correct |
19 | Correct | 863 ms | 352 KB | Output is correct |
20 | Correct | 18 ms | 508 KB | Output is correct |
21 | Incorrect | 665 ms | 256 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Correct | 2 ms | 376 KB | Output is correct |
5 | Correct | 2 ms | 256 KB | Output is correct |
6 | Correct | 2 ms | 256 KB | Output is correct |
7 | Correct | 2 ms | 376 KB | Output is correct |
8 | Correct | 2 ms | 256 KB | Output is correct |
9 | Correct | 2 ms | 376 KB | Output is correct |
10 | Correct | 2 ms | 256 KB | Output is correct |
11 | Correct | 2 ms | 376 KB | Output is correct |
12 | Correct | 2 ms | 376 KB | Output is correct |
13 | Correct | 2 ms | 376 KB | Output is correct |
14 | Correct | 2 ms | 376 KB | Output is correct |
15 | Correct | 2 ms | 376 KB | Output is correct |
16 | Correct | 2 ms | 376 KB | Output is correct |
17 | Correct | 6 ms | 256 KB | Output is correct |
18 | Correct | 78 ms | 376 KB | Output is correct |
19 | Correct | 863 ms | 352 KB | Output is correct |
20 | Correct | 18 ms | 508 KB | Output is correct |
21 | Incorrect | 665 ms | 256 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |