Submission #211238

# Submission time Handle Problem Language Result Execution time Memory
211238 2020-03-19T16:10:21 Z mr_stefan Teams (CEOI11_tea) C++14
0 / 100
687 ms 42916 KB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

const int VAL=1000005;

int N, i, j, nr, M;
pair <int, int> elev[VAL];
vector <int> V[VAL];
vector <int> :: iterator it;

bool cmp(pair <int, int> A, pair <int, int> B)
{
    return A.first>B.first;
}

int main()
{
    cin >> N;
    for (i=1; i<=N; i++)
    {
        cin >> elev[i].first;
        elev[i].second=i;
    }
    sort(elev+1, elev+N+1, cmp);
    for (i=1; i<=N; i++)
    {
        if (nr>0)
        {
            nr--;
            V[M].push_back(elev[i].second);
        }
        else
        {
            if (elev[i].first<=N-i+1)
            {
                M++;
                V[M].push_back(elev[i].second);
                nr=elev[i].first-1;
            }
            else
                V[M].push_back(elev[i].second);
        }
    }
    cout << M << '\n';
    for (i=1; i<=M; i++)
    {
        cout << V[i].size() << " ";
        for (it=V[i].begin(); it!=V[i].end(); it++)
            cout << *it << " ";
        cout << '\n';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 17 ms 23808 KB Output is correct
2 Correct 17 ms 23808 KB Output is correct
3 Incorrect 17 ms 24064 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 23808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 23808 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 23936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 23932 KB Output is correct
2 Incorrect 20 ms 23936 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 64 ms 25360 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 69 ms 25560 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 454 ms 38364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 655 ms 42916 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 687 ms 42736 KB Output isn't correct
2 Halted 0 ms 0 KB -