답안 #646263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
646263 2022-09-29T10:44:02 Z berr Olympiads (BOI19_olympiads) C++17
13 / 100
282 ms 262144 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long

int32_t main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);

    int n, k, c; cin>>n>>k>>c;

    vector<vector<int>> a[k+1];
    vector<vector<int>> b(n, vector<int>(k));

    for(int i=0; i<n; i++)
    {
        for(int l=0; l<k; l++)
        {
            cin>>b[i][l];
        }
    }


    for(int i=0; i<n; i++)
    {
        for(int l=k-1; l>=1; l--)
        {   
            for(auto p: a[l])
            {
                vector<int> s=p;

                for(int j=0; j<k; j++) s[j]=max(s[j], b[i][j]);

                a[l+1].push_back(s);
            }
        }
        a[1].push_back(b[i]);
    }

    vector<int> ans;
    for(int i=0; i<a[k].size(); i++)
    {
        int s=0;
        for(auto l: a[k][i])
        {
            s+=l;
        }
        ans.push_back(s);
    }

    sort(ans.begin(), ans.end(), greater<int>());

    cout<<ans[c-1];
}

Compilation message

olympiads.cpp: In function 'int32_t main()':
olympiads.cpp:40:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |     for(int i=0; i<a[k].size(); i++)
      |                  ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 9220 KB Output is correct
2 Correct 20 ms 9220 KB Output is correct
3 Correct 18 ms 9220 KB Output is correct
4 Correct 16 ms 9204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 278 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 282 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 9220 KB Output is correct
2 Correct 20 ms 9220 KB Output is correct
3 Correct 18 ms 9220 KB Output is correct
4 Correct 16 ms 9204 KB Output is correct
5 Runtime error 278 ms 262144 KB Execution killed with signal 9
6 Halted 0 ms 0 KB -