Submission #899398

#TimeUsernameProblemLanguageResultExecution timeMemory
899398Muhammad_AneeqSails (IOI07_sails)C++17
40 / 100
1061 ms3148 KiB
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #include <iostream> #include <queue> #include <vector> #include <algorithm> using namespace std; void solve() { int n; cin>>n; pair<int,int>a[n]; for (auto &i:a) cin>>i.first>>i.second; sort(a,a+n); priority_queue<int,vector<int>,greater<int>>pq; long long ans=0; for (auto [h,k]:a) { while (pq.size()<h) pq.push(0); vector<int>z; while (k--) { z.push_back(pq.top()); pq.pop(); } for (auto i:z) { ans+=i; pq.push(i+1); } } cout<<ans<<endl; } int main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }

Compilation message (stderr)

sails.cpp: In function 'void solve()':
sails.cpp:24:19: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int, std::vector<int>, std::greater<int> >::size_type' {aka 'long unsigned int'} and 'std::tuple_element<0, std::pair<int, int> >::type' {aka 'int'} [-Wsign-compare]
   24 |   while (pq.size()<h)
      |          ~~~~~~~~~^~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...