Submission #521785

# Submission time Handle Problem Language Result Execution time Memory
521785 2022-02-03T06:29:59 Z christinelynn Colouring a rectangle (eJOI19_colouring) C++17
20 / 100
1085 ms 16760 KB
#include<bits/stdc++.h>
using namespace std;
long long arr1[1000000], arr2[1000000], arr[101][101];
int main(){
long long n, m;
cin>>n>>m;
for(long long i=0; i<n+m-1; i++)
    cin>>arr1[i];
for(long long i=0; i<n+m-1; i++)
    cin>>arr2[i];
long long hi=m+n-1, mini=2e18;
for(long long i=0; i<(1<<hi); i++){
    for(long long a=0; a<n; a++)
        for(long long b=0; b<m; b++)
            arr[a][b]=0;
    long long tot=0;
    for(long long j=0; j<hi; j++){
        if(i&(1<<j)){
            for(long long k=0; k<n; k++)
                if(j-k>=0 && j-k<m)
                    arr[k][j-k]=1;
            tot+=arr2[j];
        }
    }
    set<long long> si;
    for(long long j=0; j<n; j++){
        for(long long k=0; k<m; k++){
            if(arr[j][k]==0)
                si.insert(j-k+m-1);
        }
    }
    for(auto x:si)
        tot+=arr1[x];
    mini=min(mini, tot);
}
cout<<mini;
return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1085 ms 296 KB Output is correct
12 Correct 18 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 300 KB Output is correct
16 Correct 1057 ms 300 KB Output is correct
17 Correct 10 ms 204 KB Output is correct
18 Correct 1077 ms 300 KB Output is correct
19 Correct 491 ms 292 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1085 ms 296 KB Output is correct
12 Correct 18 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 300 KB Output is correct
16 Correct 1057 ms 300 KB Output is correct
17 Correct 10 ms 204 KB Output is correct
18 Correct 1077 ms 300 KB Output is correct
19 Correct 491 ms 292 KB Output is correct
20 Incorrect 2 ms 204 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1085 ms 296 KB Output is correct
12 Correct 18 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 300 KB Output is correct
16 Correct 1057 ms 300 KB Output is correct
17 Correct 10 ms 204 KB Output is correct
18 Correct 1077 ms 300 KB Output is correct
19 Correct 491 ms 292 KB Output is correct
20 Incorrect 2 ms 204 KB Output isn't correct
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 189 ms 16760 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 303 ms 15168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 1085 ms 296 KB Output is correct
12 Correct 18 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 2 ms 204 KB Output is correct
15 Correct 2 ms 300 KB Output is correct
16 Correct 1057 ms 300 KB Output is correct
17 Correct 10 ms 204 KB Output is correct
18 Correct 1077 ms 300 KB Output is correct
19 Correct 491 ms 292 KB Output is correct
20 Incorrect 2 ms 204 KB Output isn't correct
21 Halted 0 ms 0 KB -