Submission #875420

# Submission time Handle Problem Language Result Execution time Memory
875420 2023-11-19T16:12:05 Z ElenaBM Teams (CEOI11_tea) C++17
0 / 100
415 ms 26176 KB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin>> n;
    vector<int>a;
    vector<pair<int,int>>v(n);
    for (int i = 0; i < n; ++i){
        int x;
        cin>> x;
        v[i] = {x, i+1};
    }
    sort(v.begin(), v.end());
    int num = 0, ans = 0;
    int i = n-1;
    while(i >= 0){
            if (i - v[i].first >= 0){
                int aux = i;
                i -= (v[i].first-1);
                ans++;
                if (i - (v[i].first-1) < 0){
                    //cout<< i - (v[i].first-1)<< '\n';
                    a.push_back(aux+1);
                }
                else a.push_back(v[aux].first);
            }
            else break;
    }
    cout<< ans << '\n';
    i = n-1;
    for (int j = 0; j < (int) a.size(); ++j){
        cout<< a[j]<< ' ';
        while(a[j]){
            cout<< v[i].second<< ' ';
            i--;
            a[j]--;
        }
        cout<< '\n';
    }
    return 0;
}

Compilation message

tea.cpp: In function 'int main()':
tea.cpp:17:9: warning: unused variable 'num' [-Wunused-variable]
   17 |     int num = 0, ans = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Integer 0 violates the range [1, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 100]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 4999]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 348 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 5000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 28 ms 2564 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 33 ms 2908 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 254 ms 19496 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 415 ms 26176 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 377 ms 18672 KB Integer parameter [name=k_j] equals to 0, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -