Submission #302354

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3023542020-09-18 15:57:00ElyesChaabouniHiring (IOI09_hiring)C++14
50 / 100
789 ms18616 KiB
#include <bits/stdc++.h>
#define MOD 998244353
using namespace std;
bool compare(pair<int, int>a, pair<int, int>b)
{
return a.first*b.second < a.second*b.first;
}
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
long long n, w;
cin >> n >> w;
vector<pair<long long, long long> >v;
for(int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
v.push_back(make_pair(x, y));
}
sort(v.begin(), v.end(), compare);
priority_queue<pair<int, int> >pq;
long long sum=0;
long long ma=0, idx=0, ma_v_s, ma_v_q;
for(int i = 0; i < n; i++)
{
sum+=v[i].second;
pq.push(make_pair(v[i].second, i));
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

hiring.cpp: In function 'int main()':
hiring.cpp:36:16: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   36 |   if(pq.size() > ma && !pq.empty())
      |      ~~~~~~~~~~^~~~
hiring.cpp:43:21: warning: comparison of integer expressions of different signedness: 'std::priority_queue<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   43 |   else if(pq.size() == ma && ma_v_s*v[i].second > ma_v_q*v[i].first*sum)
      |           ~~~~~~~~~~^~~~~
hiring.cpp:43:57: warning: 'ma_v_q' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |   else if(pq.size() == ma && ma_v_s*v[i].second > ma_v_q*v[i].first*sum)
      |                                                   ~~~~~~^~~~~~~~~~~
hiring.cpp:43:36: warning: 'ma_v_s' may be used uninitialized in this function [-Wmaybe-uninitialized]
   43 |   else if(pq.size() == ma && ma_v_s*v[i].second > ma_v_q*v[i].first*sum)
      |                              ~~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...