답안 #288734

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
288734 2020-09-01T19:38:29 Z eagle30 Colouring a rectangle (eJOI19_colouring) C++14
30 / 100
1416 ms 6648 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];
if(n==1){
    long long hi=n+m-1;
    long long tot=0;
    for(long long i=0; i<hi; i++){
        tot+=min(arr1[i], arr2[hi-i-1]);
    }
    cout<<tot;
    return 0;
}
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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1408 ms 384 KB Output is correct
12 Correct 23 ms 384 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 1399 ms 504 KB Output is correct
17 Correct 10 ms 384 KB Output is correct
18 Correct 1416 ms 384 KB Output is correct
19 Correct 650 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1408 ms 384 KB Output is correct
12 Correct 23 ms 384 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 1399 ms 504 KB Output is correct
17 Correct 10 ms 384 KB Output is correct
18 Correct 1416 ms 384 KB Output is correct
19 Correct 650 ms 504 KB Output is correct
20 Incorrect 2 ms 384 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1408 ms 384 KB Output is correct
12 Correct 23 ms 384 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 1399 ms 504 KB Output is correct
17 Correct 10 ms 384 KB Output is correct
18 Correct 1416 ms 384 KB Output is correct
19 Correct 650 ms 504 KB Output is correct
20 Incorrect 2 ms 384 KB Output isn't correct
21 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 333 ms 3508 KB Output is correct
2 Correct 335 ms 3704 KB Output is correct
3 Correct 335 ms 3448 KB Output is correct
4 Correct 348 ms 3448 KB Output is correct
5 Correct 366 ms 3448 KB Output is correct
6 Correct 292 ms 3448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 723 ms 6648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 512 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 1408 ms 384 KB Output is correct
12 Correct 23 ms 384 KB Output is correct
13 Correct 1 ms 512 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 384 KB Output is correct
16 Correct 1399 ms 504 KB Output is correct
17 Correct 10 ms 384 KB Output is correct
18 Correct 1416 ms 384 KB Output is correct
19 Correct 650 ms 504 KB Output is correct
20 Incorrect 2 ms 384 KB Output isn't correct
21 Halted 0 ms 0 KB -