제출 #525791

#제출 시각아이디문제언어결과실행 시간메모리
525791ali22413836Olympiads (BOI19_olympiads)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h>
#define  endl "\n"
using namespace std ;
typedef int ll;
typedef long double ld ;
ll mypower(ll x, ll y){
    if(y == 0) return 1 ;
    if(y == 1) return x ;
    ll ret = mypower(x , y / 2);
    ret = (ret * ret) % mod;
    if(y % 2) ret = ( ret * x ) % mod ;
    return ret ;
}
ll n , k , c ;
ll a[509][509] ;
set < pair < ll , vector < ll > > > ss;
bool can(ll ind , vector < ll > x){
    for(auto p : x){
        if (p == ind)
            return 0 ;
    }
    return 1 ;
}
vector < ll > ans ;
int main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    scanf("%d%d%d", &n, &k, &c);
    for(int i = 1 ; i <= n ; i++){
        for(int j = 1 ; j <= k ; j++){
            scanf("%d", &a[i][j]) ;
        }
    }
    ss.insert({0 , {}}) ;
    for(int i = 1 ; i <= k ; i++){
        set < pair < ll , vector < ll > > > ss2 ;
        for(auto p : ss){
            for(int j = 1 ; j <= n ; j++){
                if(can(j , p.second)){
                    vector < ll > nv = p.second ;
                    nv.push_back(j) ;
                    sort(nv.begin() , nv.end()) ;
                    ll nco = 0 ;
                    for(int l = 1 ; l <= nv.size() ; l++){
                        ll mx = 0 ;
                        for(auto q : nv){
                            mx = max(mx , a[q][l]) ;
                        }
                        nco += mx ;
                    }
                    ss2.insert({nco , nv}) ;
                }
            }
            while(ss2.size() > c + 200){
                ss2.erase(ss2.begin()) ;
            }
        }
        ss = ss2 ;
    }
    for(auto p : ss)
        ans.push_back(p.first);
    printf("%d\n", ans[ans.size() - c]);
    return 0 ;
}
		

컴파일 시 표준 에러 (stderr) 메시지

olympiads.cpp: In function 'll mypower(ll, ll)':
olympiads.cpp:10:25: error: 'mod' was not declared in this scope; did you mean 'modf'?
   10 |     ret = (ret * ret) % mod;
      |                         ^~~
      |                         modf
olympiads.cpp: In function 'int main()':
olympiads.cpp:43:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                     for(int l = 1 ; l <= nv.size() ; l++){
      |                                     ~~^~~~~~~~~~~~
olympiads.cpp:53:30: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<int, std::vector<int> > >::size_type' {aka 'long unsigned int'} and 'll' {aka 'int'} [-Wsign-compare]
   53 |             while(ss2.size() > c + 200){
      |                   ~~~~~~~~~~~^~~~~~~~~
olympiads.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |     scanf("%d%d%d", &n, &k, &c);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
olympiads.cpp:30:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |             scanf("%d", &a[i][j]) ;
      |             ~~~~~^~~~~~~~~~~~~~~~