# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
870063 |
2023-11-06T20:13:57 Z |
Matjaz |
Teams (CEOI11_tea) |
C++14 |
|
365 ms |
29116 KB |
//
// CEOI11_TEA.cpp
//
//
// Created by Matjaz Leonardis on 06/11/2023.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int N;
cin >> N;
vector<pair<int,int> > a(N);
for (int i=0;i<N;i++){
cin >> a[i].first;
a[i].second = i + 1;
}
sort(a.begin(), a.end());
vector<int> max_teams(N);
vector<int> label(N);
if (a[0].first == 1) {
max_teams[0] = 1;
label[0] = 1;
} else max_teams[0] = 0;
for (int i=1;i<N;i++){
max_teams[i] = max_teams[i-1];
if (i + 1 - a[i].first == 0 && max_teams[i] < 1){
max_teams[i] = 1;
label[i] = 1;
}
if (i + 1 - a[i].first > 0 && max_teams[i] < 1 + max_teams[i-a[i].first] ){
max_teams[i] = 1 + max_teams[i-a[i].first];
label[i] = 1;
}
}
cout << max_teams[N-1] << endl;
//for (int i=0;i<N;i++) cout << label[i] << " ";
cout << endl;
for (int ptr=N-1;ptr>=0;ptr--){
if (label[ptr] != 0){
cout << a[ptr].first;
for (int i=0;i<a[ptr].first;i++){
cout << " " << a[ptr - i].second;
}
cout << endl;
ptr -= a[ptr].first - 1;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
2556 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
2572 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
245 ms |
20916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
360 ms |
28500 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
365 ms |
29116 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |