Submission #541948

# Submission time Handle Problem Language Result Execution time Memory
541948 2022-03-24T21:00:21 Z DemonLord154 Poi (IOI09_poi) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
struct Player{
  int score;
  int id;
  int probSolved;
  Player(int sc,int i,int prb){
    score=sc;
    id=i;
    probSolved=prb;
  }
};
bool comparator(Player player1,Player player2){
  if (player1.score != player2.score){
    return player1.score<player2.score;
  }
  if (player1.probSolved!= player2.probSolved){
    return player1.probSolved < player2.probSolved;
  }
  return player1.id<player2.id;
}
int main(){
  int n,t,p;
  cin>>n>>t>>p;
  vector<Player> players(n);
  int scores[n][t];
  for (int i=0;i<n;i++){
    for (int j=0;j<t;j++){
      cin>>scores[i][j];
    }
  }
  vector<int> eachTestScore(t);
  for (int i=0;i<t;i++){
    int score=0;
    for (int j=0;j<n;j++){
      if (scores[j][i]==0){
        score++;
      }
    }
    eachTestScore[i]=score;
  }
  for (int i=0;i<n;i++){
    int playerScore=0,probsolved=0;
    for (int j=0;j<t;j++){
      if (scores[i][j]==1){
        playerScore+=eachTestScore[j];
        probsolved++;
      }
    }
    players[i].score=playerScore;
    players[i].id=i;
    players[i].probSolved=probsolved;
  }
  sort(players.begin(),players.end(),comparator);
  for (int i=0;i<n;i++){
    if (players[i].id==p-1){
      cout<<players[i].score<<" "<<n-i<<endl;
      break;
    }
  }
}

Compilation message

In file included from /usr/include/c++/10/bits/alloc_traits.h:33,
                 from /usr/include/c++/10/ext/alloc_traits.h:34,
                 from /usr/include/c++/10/bits/basic_string.h:40,
                 from /usr/include/c++/10/string:55,
                 from /usr/include/c++/10/bits/locale_classes.h:40,
                 from /usr/include/c++/10/bits/ios_base.h:41,
                 from /usr/include/c++/10/ios:42,
                 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/stl_construct.h: In instantiation of 'void std::_Construct(_Tp*, _Args&& ...) [with _Tp = Player; _Args = {}]':
/usr/include/c++/10/bits/stl_uninitialized.h:567:18:   required from 'static _ForwardIterator std::__uninitialized_default_n_1<_TrivialValueType>::__uninit_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Player*; _Size = long unsigned int; bool _TrivialValueType = false]'
/usr/include/c++/10/bits/stl_uninitialized.h:623:20:   required from '_ForwardIterator std::__uninitialized_default_n(_ForwardIterator, _Size) [with _ForwardIterator = Player*; _Size = long unsigned int]'
/usr/include/c++/10/bits/stl_uninitialized.h:685:44:   required from '_ForwardIterator std::__uninitialized_default_n_a(_ForwardIterator, _Size, std::allocator<_Tp>&) [with _ForwardIterator = Player*; _Size = long unsigned int; _Tp = Player]'
/usr/include/c++/10/bits/stl_vector.h:1606:36:   required from 'void std::vector<_Tp, _Alloc>::_M_default_initialize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = Player; _Alloc = std::allocator<Player>; std::vector<_Tp, _Alloc>::size_type = long unsigned int]'
/usr/include/c++/10/bits/stl_vector.h:512:9:   required from 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = Player; _Alloc = std::allocator<Player>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<Player>]'
poi.cpp:25:27:   required from here
/usr/include/c++/10/bits/stl_construct.h:109:7: error: no matching function for call to 'Player::Player()'
  109 |     { ::new(static_cast<void*>(__p)) _Tp(std::forward<_Args>(__args)...); }
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
poi.cpp:7:3: note: candidate: 'Player::Player(int, int, int)'
    7 |   Player(int sc,int i,int prb){
      |   ^~~~~~
poi.cpp:7:3: note:   candidate expects 3 arguments, 0 provided
poi.cpp:3:8: note: candidate: 'constexpr Player::Player(const Player&)'
    3 | struct Player{
      |        ^~~~~~
poi.cpp:3:8: note:   candidate expects 1 argument, 0 provided
poi.cpp:3:8: note: candidate: 'constexpr Player::Player(Player&&)'
poi.cpp:3:8: note:   candidate expects 1 argument, 0 provided