# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
211237 |
2020-03-19T16:06:34 Z |
mr_stefan |
Teams (CEOI11_tea) |
C++14 |
|
713 ms |
49504 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];
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 (j=0; j<V[i].size(); j++)
cout << V[i][j] << " ";
cout << '\n';
}
return 0;
}
Compilation message
tea.cpp: In function 'int main()':
tea.cpp:50:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j=0; j<V[i].size(); j++)
~^~~~~~~~~~~~
# |
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 |
23808 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
23808 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
18 ms |
23808 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
23936 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
23936 KB |
Output is correct |
2 |
Incorrect |
20 ms |
23936 KB |
Output isn't correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
66 ms |
25868 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
70 ms |
26104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
433 ms |
42104 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
624 ms |
48496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
713 ms |
49504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |