답안 #485453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
485453 2021-11-07T22:22:07 Z asij123 Poi (IOI09_poi) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

int n; int t; int p;



struct Contestant{
    ll ID;

    ll numSolved=0; ll score=0; 

    int problemSet[INT_MAX]= {0};


 };

 bool comp(Contestant one, Contestant two){

    if(one.score== two.score){
        if(one.numSolved==two.numSolved){
            return one.ID > two.ID;
        }
        return one.numSolved< two.numSolved;
    }

    return one.score < two.score;
}

 int main(){
     cin >> n; cin >> t; cin >> p;

     Contestant arr [n];

     for(int i=1; i<= n; i++){
         Contestant& con= arr[i-1];
         con.ID= i;

         for(int j=0; j<t; j++){
             
             int ans; cin >>ans;
            
             con.problemSet[j]= ans;

             if(ans == 1){
                 con.numSolved++;
             }
        }
     }



     for(int i=0; i< t; i++){
        int points=0;

        for(Contestant& a: arr){
            if(a.problemSet[i]==0) points++;
        }


        for(Contestant& a: arr){
            if(a.problemSet[i]==1) a.score+=points;
           
        }
     }

     sort(arr, arr+n, comp);


     for(int i=0; i< n; i++){
         if(arr[i].ID== p){
             cout << arr[i].score << " " << (n-i);
         }
     }
     





     




 }

Compilation message

In file included from /usr/include/c++/10/bits/stl_algobase.h:71,
                 from /usr/include/c++/10/bits/char_traits.h:39,
                 from /usr/include/c++/10/ios:40,
                 from /usr/include/c++/10/istream:38,
                 from /usr/include/c++/10/sstream:38,
                 from /usr/include/c++/10/complex:45,
                 from /usr/include/c++/10/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:54,
                 from poi.cpp:1:
/usr/include/c++/10/bits/predefined_ops.h: In function 'void std::__unguarded_linear_insert(_RandomAccessIterator, _Compare) [with _RandomAccessIterator = Contestant*; _Compare = __gnu_cxx::__ops::_Val_comp_iter<bool (*)(Contestant, Contestant)>]':
/usr/include/c++/10/bits/predefined_ops.h:238:16: sorry, unimplemented: passing too large argument on stack
  238 |  { return bool(_M_comp(__val, *__it)); }
      |                ^~~~~~~
/usr/include/c++/10/bits/predefined_ops.h:238:16: sorry, unimplemented: passing too large argument on stack
/usr/include/c++/10/bits/predefined_ops.h:238: confused by earlier errors, bailing out