답안 #1071251

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071251 2024-08-23T06:16:06 Z 12345678 Cultivation (JOI17_cultivation) C++17
5 / 100
2000 ms 1116 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

using namespace std;

const int nx=305;

int sr, sc, n, a[nx], b[nx], qs[nx][nx], res=INT_MAX;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>sr>>sc>>n;
    for (int i=1; i<=n; i++) cin>>a[i]>>b[i];
    for (int up=0; up<sr; up++)
    {
        for (int dn=0; dn<sr; dn++)
        {
            for (int l=0; l<sc; l++)
            {
                for (int r=0; r<sc; r++)
                {
                    if (up+dn+l+r>sr+sc) continue;
                    for (int i=1; i<=sr; i++) for (int j=1; j<=sc ;j++) qs[i][j]=0;
                    for (int i=1; i<=n; i++) for (int j=max(1, a[i]-up); j<=min(sr, a[i]+dn); j++) qs[j][max(1, b[i]-l)]++, qs[j][min(sc, b[i]+r)+1]--;
                    for (int i=1; i<=sr; i++) for (int j=1; j<=sc; j++) qs[i][j]+=qs[i][j-1];
                    bool f=0;
                    for (int i=1; i<=sr; i++) for (int j=1; j<=sc; j++) if (qs[i][j]==0) f=1;
                    if (!f) res=min(res, up+dn+l+r);
                }
            }
        }
    }
    cout<<res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 11 ms 348 KB Output is correct
18 Correct 247 ms 344 KB Output is correct
19 Correct 1443 ms 344 KB Output is correct
20 Correct 35 ms 348 KB Output is correct
21 Correct 1233 ms 488 KB Output is correct
22 Execution timed out 2045 ms 344 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 11 ms 348 KB Output is correct
18 Correct 247 ms 344 KB Output is correct
19 Correct 1443 ms 344 KB Output is correct
20 Correct 35 ms 348 KB Output is correct
21 Correct 1233 ms 488 KB Output is correct
22 Execution timed out 2045 ms 344 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 1116 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 1116 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 468 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 11 ms 348 KB Output is correct
18 Correct 247 ms 344 KB Output is correct
19 Correct 1443 ms 344 KB Output is correct
20 Correct 35 ms 348 KB Output is correct
21 Correct 1233 ms 488 KB Output is correct
22 Execution timed out 2045 ms 344 KB Time limit exceeded
23 Halted 0 ms 0 KB -