Submission #837462

#TimeUsernameProblemLanguageResultExecution timeMemory
837462AndreySails (IOI07_sails)C++14
30 / 100
1088 ms2544 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n,a,b,ans = 0; cin >> n; vector<pair<int,int>> haha(0); vector<int> yay(0); for(int i = 0; i < n; i++) { cin >> a >> b; haha.push_back({a,b}); } sort(haha.begin(),haha.end()); for(int i = 0; i < n; i++) { a = haha[i].first; b = haha[i].second; while(yay.size() < a) { yay.push_back(0); } sort(yay.begin(),yay.end()); for(int j = 0; j < b; j++) { ans+=yay[j]; yay[j]++; } } cout << ans; return 0; }

Compilation message (stderr)

sails.cpp: In function 'int main()':
sails.cpp:21:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   21 |         while(yay.size() < a) {
      |               ~~~~~~~~~~~^~~
#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...