Submission #882897

#TimeUsernameProblemLanguageResultExecution timeMemory
882897MatjazSails (IOI07_sails)C++14
15 / 100
1099 ms4832 KiB
// // IOI2007Sails.cpp // // // Created by Matjaz Leonardis on 04/12/2023. // #include <iostream> #include <vector> #include <algorithm> #include <queue> using namespace std; int INF = 100001; int main(){ int N; cin >> N; vector<int> H(N),K(N); for (int i=0;i<N;i++) cin >> H[i] >> K[i]; vector<int> S(100001); for (int i=N-1;i>=0;i--){ priority_queue<pair<int,int> > Q; for (int j=1;j<=H[i];j++) Q.push(make_pair(-S[j], j)); for (int j=0;j<K[i];j++){ S[Q.top().second]++; Q.pop(); } } long long total=0; for (int i=0;i<S.size();i++){ total += ((long long)S[i] * (S[i] - 1)) / 2; } cout << total << endl; return 0; }

Compilation message (stderr)

sails.cpp: In function 'int main()':
sails.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i=0;i<S.size();i++){
      |                  ~^~~~~~~~~
#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...