# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
532462 | 2022-03-02T23:53:46 Z | definitelynotmee | Teams (CEOI11_tea) | C++ | 281 ms | 72812 KB |
#include<bits/stdc++.h> #define mp make_pair #define mt make_tuple #define all(x) x.begin(), x.end() #define ff first #define ss second using namespace std; template <typename T> using matrix = vector<vector<T>>; typedef unsigned int uint; typedef unsigned long long ull; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const double EPS = 1e-7; const int MOD = 1e9 + 7; const int RANDOM = chrono::high_resolution_clock::now().time_since_epoch().count(); const int MAXN = 1e6+1; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<int> v(n); for(int i = 0; i < n; i++) cin >> v[i]; vector<int> o(n); iota(all(o),0); stable_sort(all(o),[&](int a, int b){return v[a] > v[b];}); matrix<int> resp; int cur = 0; while(cur < n){ //cout << cur << ' '; if(v[o[cur]] <= n-cur){ //cout << 'a' <<endl; resp.push_back({}); for(int i = cur; i < cur+v[o[cur]]; i++){ resp.back().push_back(o[i]); } cur+=v[o[cur]]; continue; } //cout << 'b' << '\n'; int sz = resp.back().size(); int ini = 0, fim = resp.size()-1; while(ini!=fim){ int m = (ini+fim)>>1; if(resp[m].size() == sz) fim = m; else ini = m+1; } resp[ini].push_back(o[cur]); cur++; } cout << resp.size() << '\n'; for(vector<int>& i : resp){ cout << i.size() << ' '; for(int j : i) cout << j+1 << ' '; cout << '\n'; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
4 | Correct | 0 ms | 204 KB | Output is correct |
5 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 0 ms | 204 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 332 KB | Output is correct |
2 | Correct | 1 ms | 332 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 1912 KB | Output is correct |
2 | Correct | 18 ms | 1868 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 2016 KB | Output is correct |
2 | Correct | 14 ms | 1976 KB | Output is correct |
3 | Correct | 19 ms | 2036 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 154 ms | 14784 KB | Output is correct |
2 | Correct | 142 ms | 16516 KB | Output is correct |
3 | Correct | 184 ms | 16040 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 224 ms | 19772 KB | Output is correct |
2 | Correct | 281 ms | 72812 KB | Output is correct |
3 | Correct | 184 ms | 21888 KB | Output is correct |
4 | Correct | 233 ms | 17140 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 245 ms | 21956 KB | Output is correct |
2 | Correct | 179 ms | 22988 KB | Output is correct |
3 | Correct | 210 ms | 19788 KB | Output is correct |
4 | Correct | 281 ms | 19348 KB | Output is correct |