답안 #647600

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647600 2022-10-03T09:42:21 Z berr Olympiads (BOI19_olympiads) C++17
44 / 100
1217 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
 
int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
 
    int n, k, c; cin>>n>>k>>c;
    vector<vector<int>> ar(n, vector<int>(k));
    vector<int> ans;
 
    for(int i=0; i<n; i++)
    {
        for(int l=0; l<k; l++)
            cin>>ar[i][l];
    }
 
    if(k==1)
    {
        for(int a=0; a<n; a++)
        ans.push_back(ar[a][0]);
    } 
    else if(k==2)
    {
        for(int a=0; a<n; a++)
        {
            for(int b=a+1; b<n; b++)
            {
                int sum=0;
                for(int i=0; i<k; i++)
                {
                    sum+=max(ar[a][i], ar[b][i]);
                }
                ans.push_back(sum);
            }
        }
    }
    else if(k==3)
    {
 
        for(int a=0; a<n; a++)
        {
            for(int b=a+1; b<n; b++)
            {
                for(int c=b+1; c<n; c++)
                {          
                    int sum=0;
                    for(int i=0; i<k; i++)
                    {
                        sum+=max({ar[a][i], ar[b][i], ar[c][i]});
                    }
 
                    ans.push_back(sum); 
                }
            }
        }
    }
    else if(k==4)
    {
        for(int a=0; a<n; a++)
        {
            for(int b=a+1; b<n; b++)
            {
                for(int c=b+1; c<n; c++)
                {
                    for(int d=c+1; d<n; d++)
                    {
                        int sum=0;
                        for(int i=0; i<k; i++)
                        {
                            sum+=max({ar[a][i], ar[b][i], ar[c][i], ar[d][i]});
                        }
 
                        ans.push_back(sum);
                    }
                }
            }
        }
    }
    else if(k==5)
    {
        for(int a=0; a<n; a++)
        {
            for(int b=a+1; b<n; b++)
            {
                for(int c=b+1; c<n; c++)
                {
                    for(int d=c+1; d<n; d++)
                    {
                        for(int e=d+1; e<n; e++)
                        {
 
                            int sum=0;
                            for(int i=0; i<k; i++)
                            {
                                sum+=max({ar[a][i], ar[b][i], ar[c][i], ar[d][i], ar[e][i]});
                            }
 
                            ans.push_back(sum);
                        
                        }
                    }
                }
            }
        }
 
    }
    else if(k==6)
    {
        for(int a=0; a<n; a++)
        {
            for(int b=a+1; b<n; b++)
            {
                for(int c=b+1; c<n; c++)
                {
                    for(int d=c+1; d<n; d++)
                    {
                        for(int e=d+1; e<n; e++)
                        {
                            for(int f=e+1; f<n; f++)
                            {
                                int sum=0;
                                for(int i=0; i<k; i++)
                                {
                                    sum+=max({ar[a][i], ar[b][i], ar[c][i], ar[d][i], ar[e][i], ar[f][i]});
                                }
 
                                ans.push_back(sum);
                            }
                        }
                    }
                }
            }
        }
    }
 
 
    
    sort(ans.begin(), ans.end());
    reverse(ans.begin(), ans.end());
    cout<<ans[c-1];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 980 KB Output is correct
2 Correct 9 ms 960 KB Output is correct
3 Correct 6 ms 960 KB Output is correct
4 Correct 3 ms 968 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 387 ms 16824 KB Output is correct
2 Correct 408 ms 16808 KB Output is correct
3 Correct 442 ms 16864 KB Output is correct
4 Correct 395 ms 16864 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1217 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 980 KB Output is correct
2 Correct 9 ms 960 KB Output is correct
3 Correct 6 ms 960 KB Output is correct
4 Correct 3 ms 968 KB Output is correct
5 Correct 387 ms 16824 KB Output is correct
6 Correct 408 ms 16808 KB Output is correct
7 Correct 442 ms 16864 KB Output is correct
8 Correct 395 ms 16864 KB Output is correct
9 Runtime error 1217 ms 262144 KB Execution killed with signal 9
10 Halted 0 ms 0 KB -