Submission #317284

#TimeUsernameProblemLanguageResultExecution timeMemory
317284shrek12357Teams (CEOI11_tea)C++14
0 / 100
344 ms33512 KiB
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <map> #include <set> #include <climits> #include <cmath> #include <fstream> #include <queue> #include <stack> #include <bitset> using namespace std; #define ll long long //cin.tie(0);ios_base::sync_with_stdio(0); int main() { cin.tie(0);ios_base::sync_with_stdio(0); int n; cin >> n; int counter = 0; vector<int> nums; priority_queue<pair<int, int>> pq; priority_queue<pair<int, int>> groups; for (int i = 0; i < n; i++) { int temp; cin >> temp; pq.push({ temp, i }); } vector<vector<int>> ans; while (pq.size() > 0) { int cur = pq.top().first, idx = pq.top().second; pq.pop(); cur--; if (cur <= pq.size()) { vector<int> temp; temp.push_back(idx); ans.push_back(temp); for (int i = 0; i < cur; i++) { ans[counter].push_back(pq.top().second); pq.pop(); } counter++; } else { int g = groups.top().second; ans[g].push_back(idx); } } cout << counter << endl; for (int i = 0; i < ans.size(); i++) { cout << ans[i].size() << " "; for (int j = 0; j < ans[i].size(); j++) { cout << ans[i][j] + 1 << " "; } cout << endl; } }

Compilation message (stderr)

tea.cpp: In function 'int main()':
tea.cpp:35:11: warning: comparison of integer expressions of different signedness: 'int' and 'std::priority_queue<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   if (cur <= pq.size()) {
      |       ~~~~^~~~~~~~~~~~
tea.cpp:51:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |  for (int i = 0; i < ans.size(); i++) {
      |                  ~~^~~~~~~~~~~~
tea.cpp:53:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   53 |   for (int j = 0; j < ans[i].size(); j++) {
      |                   ~~^~~~~~~~~~~~~~~
#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...