# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
57488 |
2018-07-15T07:31:37 Z |
윤교준(#1672) |
Teams (CEOI11_tea) |
C++11 |
|
2500 ms |
67100 KB |
#include <bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define sz(V) ((int)(V).size())
#define allv(V) ((V).begin()),((V).end())
#define befv(V) ((V)[(sz(V)-2)])
#define sorv(V) sort(allv(V))
#define revv(V) reverse(allv(V))
#define univ(V) (V).erase(unique(allv(V)),(V).end())
#define clv(V) (V).clear()
#define upmin(a,b) (a)=min((a),(b))
#define upmax(a,b) (a)=max((a),(b))
#define rb(x) ((x)&(-(x)))
#define cb(x) (x)=(!(x))
#define INF (0x3f3f3f3f)
#define INFLL (0x3f3f3f3f3f3f3f3fll)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
const int MAXN = 1000005;
priority_queue<pii, vector<pii>, greater<pii>> PQ;
vector<int> AnsV[MAXN];
vector<int> BV[MAXN];
int A[MAXN], B[MAXN];
int N, AnsC;
int main() {
ios::sync_with_stdio(false);
cin >> N;
for(int i = 1; i <= N; i++) {
cin >> A[i];
B[i] = A[i];
}
for(int i = 1; i <= N; i++) BV[B[i]].eb(i);
sort(A+1, A+N+1); reverse(A+1, A+N+1);
for(int i = 1; i <= N;) {
if(i+A[i]-1 <= N) {
AnsC++;
for(int j = i; j < i+A[i]; j++)
AnsV[AnsC].eb(A[j]);
i += A[i];
PQ.push(pii(A[i], AnsC));
continue;
}
for(int idx, cnt;;) {
tie(cnt, idx) = PQ.top(); PQ.pop();
if(sz(AnsV[idx]) != cnt) continue;
AnsV[idx].eb(A[i]);
PQ.push(pii(cnt+1, idx));
break;
}
i++;
}
printf("%d\n", AnsC);
for(int i = 1; i <= AnsC; i++) {
printf("%d ", sz(AnsV[i]));
for(int v : AnsV[i]) {
printf("%d ", BV[v].back());
BV[v].pop_back();
}
puts("");
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
43 ms |
47352 KB |
Output is correct |
2 |
Execution timed out |
2560 ms |
47352 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
53 ms |
47412 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
45 ms |
47484 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2541 ms |
47608 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2558 ms |
47680 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2556 ms |
49520 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2531 ms |
50104 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2575 ms |
62332 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2571 ms |
66220 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2583 ms |
67100 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |