Submission #673749

# Submission time Handle Problem Language Result Execution time Memory
673749 2022-12-21T23:27:35 Z meoww Teams (CEOI11_tea) C++14
30 / 100
1505 ms 74696 KB
#include "bits/stdc++.h"
using namespace std;
signed main() {
    int n; cin>>n;
    pair<int,int> v[n];
    for (int i=0;i<n;i++) {
      cin>>v[i].first;
      v[i].second=i;
  }
    sort(v,v+n);
    vector<vector<int> > tms;
    int j=n-1;
    for (int i=n-1;i>=0;i--) {
      int nm=v[i].first;
      vector<int> tmp;
      while (j>=0 && nm>0) {
        tmp.push_back(v[j].second); nm--;
        j--;
      }
      if (nm>0) {
        priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > pq;
        for (int p=0;p<tms.size();p++) pq.push({tms[p].size(),p});
        int ntmp=0;
        while (ntmp<tmp.size()) {
          int ii=pq.top().second;
          tms[ii].push_back(tmp[ntmp]);
          ntmp++;
          pq.pop();
          pq.push({tms[ii].size(),ii});
        }
      }
      else {
        tms.push_back(tmp);
        i=j+1;
      }
    }
    cout<<tms.size()<<endl;
    for (int i=0;i<tms.size();i++) {
      cout<<tms[i].size()<<' ';
      for (int j:tms[i]) cout<<j+1<<' ';
      cout<<endl;
    }
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:22:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |         for (int p=0;p<tms.size();p++) pq.push({tms[p].size(),p});
      |                      ~^~~~~~~~~~~
tea.cpp:24:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         while (ntmp<tmp.size()) {
      |                ~~~~^~~~~~~~~~~
tea.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |     for (int i=0;i<tms.size();i++) {
      |                  ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 356 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 352 KB Output is correct
2 Correct 2 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 35 ms 2576 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 43 ms 2624 KB Output is correct
2 Correct 37 ms 2092 KB Output is correct
3 Correct 42 ms 2496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 317 ms 18480 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 439 ms 26548 KB Output is correct
2 Correct 1505 ms 74696 KB Output is correct
3 Incorrect 356 ms 22628 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 463 ms 25896 KB Output is correct
2 Correct 413 ms 26808 KB Output is correct
3 Incorrect 368 ms 23116 KB Output isn't correct
4 Halted 0 ms 0 KB -