Submission #710555

# Submission time Handle Problem Language Result Execution time Memory
710555 2023-03-15T11:00:32 Z groshi Teams (CEOI11_tea) C++17
80 / 100
398 ms 82632 KB
#include<bits/stdc++.h>

using namespace std;
vector<int> wypisz[1000006];
priority_queue<pair<int,int> > kolejka;
int32_t main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    vector<pair<int,int> > Q;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        Q.push_back({x,i});
    }
    sort(Q.begin(),Q.end());
    int ktora=1;
    for(int i=Q.size()-1;i>=0;i--)
    {
        int ile=Q[i].first;
        if(i+1<ile)
        {
            pair<int,int> para=kolejka.top();
            kolejka.pop();
            wypisz[para.second].push_back(Q[i].second);
            kolejka.push({-wypisz[para.second].size(),para.second});
        }
        else{
            for(int j=i;j>i-ile;j--)
                wypisz[ktora].push_back(Q[j].second);
            kolejka.push({-wypisz[ktora].size(),ktora});
            i-=ile;
            i++;
            ktora++;
        }
    }
    cout<<ktora-1<<"\n";
    for(int i=1;i<ktora;i++)
    {
        cout<<wypisz[i].size()<<" ";
        for(int j=0;j<wypisz[i].size();j++)
        cout<<wypisz[i][j]<<" ";
        cout<<"\n";
    }
    return 0;
}

Compilation message

tea.cpp: In function 'int32_t main()':
tea.cpp:45:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |         for(int j=0;j<wypisz[i].size();j++)
      |                     ~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 18 ms 23748 KB Output is correct
2 Correct 15 ms 23812 KB Output is correct
3 Correct 12 ms 23736 KB Output is correct
4 Correct 13 ms 23764 KB Output is correct
5 Correct 13 ms 23816 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 23744 KB Output is correct
2 Correct 15 ms 23764 KB Output is correct
3 Correct 13 ms 23712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 23812 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 23892 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 14 ms 23892 KB Output is correct
2 Correct 15 ms 23864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 25808 KB Output is correct
2 Correct 33 ms 25552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 44 ms 25996 KB Output is correct
2 Correct 31 ms 25592 KB Output is correct
3 Correct 37 ms 25964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 223 ms 41944 KB Output is correct
2 Correct 234 ms 41784 KB Output is correct
3 Correct 225 ms 43740 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 337 ms 49152 KB Output is correct
2 Correct 398 ms 82632 KB Output is correct
3 Correct 294 ms 48104 KB Output is correct
4 Correct 268 ms 45552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 333 ms 52420 KB Output is correct
2 Correct 265 ms 54324 KB Output is correct
3 Correct 282 ms 47148 KB Output is correct
4 Correct 305 ms 48464 KB Output is correct