# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
264179 | 2020-08-14T05:28:04 Z | 반딧불(#5094) | Teams (CEOI11_tea) | C++17 | 505 ms | 61056 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; int n; vector<pair<int, int> > v; int teamCnt; vector<int> lim; list<pair<int, int> > stk; bool able(int sz){ if(sz * teamCnt < n) return false; return true; } int main(){ scanf("%d", &n); for(int i=1; i<=n; i++){ int x; scanf("%d", &x); v.push_back({x, i}); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); stk.push_back({0, 0 + v[0].first}); for(int i=1; i<n; i++){ while(!stk.empty() && stk.back().second > i + v[i].first) stk.pop_back(); stk.push_back({i, i+v[i].first}); } while(!stk.empty()){ int i = stk.front().first; stk.pop_front(); if(i + v[i].first <= n){ teamCnt++; while(!stk.empty() && stk.front().first < i + v[i].first) stk.pop_front(); } else break; } printf("%d\n", teamCnt); int l = v[0].first, r = n, ans = v[0].first; while(l <= r){ int m = (l+r)>>1; if(able(m)){ ans = m; r = m-1; } else l = m+1; } int j = 0; for(int i=1; i<=teamCnt; i++){ v.clear(); lim.push_back(j); for(; j<i*ans && j<n-(teamCnt-i); j++); } lim.push_back(n); for(int i=teamCnt-1; i>=0; i--){ while(lim[i] >= lim[i+1]) lim[i]--; while(v[lim[i]].first > lim[i+1]-lim[i]) lim[i]--; } for(int i=0; i<teamCnt; i++){ printf("%d ", lim[i+1] - lim[i]); for(int j=lim[i]; j<lim[i+1]; j++) printf("%d ", v[j].second); puts(""); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 384 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Incorrect | 0 ms | 256 KB | Integer parameter [name=k_j] equals to 0, violates the range [1, 100] |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 256 KB | Integer parameter [name=k_j] equals to 0, violates the range [1, 200] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 512 KB | Integer parameter [name=k_j] equals to 0, violates the range [1, 4999] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 3944 KB | Integer parameter [name=k_j] equals to 0, violates the range [1, 80005] |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 4328 KB | Output is correct |
2 | Correct | 31 ms | 3948 KB | Output is correct |
3 | Correct | 38 ms | 4564 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 359 ms | 35048 KB | Output is correct |
2 | Runtime error | 318 ms | 61056 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 478 ms | 46140 KB | Output is correct |
2 | Runtime error | 247 ms | 40016 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 505 ms | 43800 KB | Output is correct |
2 | Correct | 381 ms | 46928 KB | Output is correct |
3 | Correct | 419 ms | 46928 KB | Output is correct |
4 | Incorrect | 461 ms | 47440 KB | Integer parameter [name=k_j] equals to 0, violates the range [1, 1000000] |