# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
773270 |
2023-07-04T18:09:14 Z |
NK_ |
Teams (CEOI11_tea) |
C++17 |
|
438 ms |
69884 KB |
// Success consists of going from failure to failure without loss of enthusiasm
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define sz(x) int(x.size())
template<class T> using V = vector<T>;
int main() {
cin.tie(0)->sync_with_stdio(0);
// smallest L (MN <= L <= N) such that there are
// N % L values less than or equal N % L
// if x = N % L => L is a divisor of (N - x)
// minimum divisor of (N - x) such that
// it is greater than or equal to MN
int N; cin >> N;
V<int> A(N); for(auto& x : A) cin >> x;
int mn = *max_element(begin(A), end(A));
V<pair<int, int>> B;
for(int i = 0; i < N; i++) B.push_back(make_pair(A[i], i));
sort(rbegin(B), rend(B));
map<int, int> C; for(auto x : A) C[x]++;
int amt = 0; V<int> pos(N);
for (int x = 0; x < N; x++) {
amt += C[x];
if (amt >= x) pos[x] = 1;
C[B[N - 1 - x].first]++;
}
for (int L = mn; L <= N; L++) {
int x = N % L; if (pos[x]) {
V<V<int>> S = {};
if (x) {
S.push_back({});
for(int i = 0; i < x; i++) {
S.back().push_back(B.back().second);
B.pop_back();
}
}
for(int t = 0; t < (N-x)/L; t++) {
S.push_back({});
for(int i = 0; i < L; i++) {
S.back().push_back(B.back().second);
B.pop_back();
}
}
cout << L << nl;
// cout << sz(S) << nl;
// for(auto v : S) {
// cout << sz(v) << " ";
// for(auto c : v) {
// assert(sz(v) >= A[c]);
// cout << c + 1 << " ";
// }
// cout << nl;
// }
break;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
596 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
5840 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
30 ms |
6344 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
306 ms |
50480 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
436 ms |
67628 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
438 ms |
69884 KB |
Unexpected end of file - int32 expected |
2 |
Halted |
0 ms |
0 KB |
- |