# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
97233 | 2019-02-14T14:29:51 Z | MohamedAhmed0 | Zalmoxis (BOI18_zalmoxis) | C++14 | 350 ms | 8640 KB |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e6 + 10 ; int freq[31] ; vector<int>ans; int n , k ; void solve(int now) { if(now == 30) return ; int occ = freq[now] ; if(occ % 2 == 0) freq[now+1] += occ / 2 ; else { ans.push_back(now) ; --k ; freq[now]++; freq[now+1] += (freq[now] / 2) ; } solve(now + 1) ; } int main() { scanf("%d %d" , &n , &k) ; int MIN = 31 ; for(int i = 0 ; i < n ; ++i) { int x ; scanf("%d" , &x) ; ans.push_back(x) ; freq[ans[i]]++; MIN = min(MIN , ans[i]) ; } solve(MIN); sort(ans.rbegin() , ans.rend()) ; if(k > 0) { int x = ans.back(); ans.pop_back(); ans.push_back(x-1) ; ans.push_back(x-1) ; } for(auto &i : ans) cout<<i<<" "; return 0 ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 221 ms | 8448 KB | doesn't contain S as a subsequence |
2 | Incorrect | 350 ms | 8544 KB | doesn't contain S as a subsequence |
3 | Incorrect | 264 ms | 8540 KB | doesn't contain S as a subsequence |
4 | Incorrect | 252 ms | 8512 KB | doesn't contain S as a subsequence |
5 | Incorrect | 249 ms | 8640 KB | doesn't contain S as a subsequence |
6 | Incorrect | 247 ms | 8412 KB | doesn't contain S as a subsequence |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 241 ms | 8452 KB | Unexpected end of file - int32 expected |
2 | Incorrect | 243 ms | 8616 KB | Unexpected end of file - int32 expected |
3 | Incorrect | 214 ms | 8532 KB | Unexpected end of file - int32 expected |
4 | Incorrect | 275 ms | 8620 KB | Unexpected end of file - int32 expected |
5 | Incorrect | 233 ms | 8524 KB | Unexpected end of file - int32 expected |
6 | Incorrect | 212 ms | 8512 KB | Unexpected end of file - int32 expected |
7 | Incorrect | 318 ms | 8596 KB | Unexpected end of file - int32 expected |
8 | Incorrect | 290 ms | 8636 KB | Unexpected end of file - int32 expected |
9 | Incorrect | 180 ms | 7004 KB | Unexpected end of file - int32 expected |
10 | Incorrect | 69 ms | 3180 KB | Unexpected end of file - int32 expected |
11 | Incorrect | 121 ms | 4552 KB | Unexpected end of file - int32 expected |
12 | Incorrect | 3 ms | 256 KB | Unexpected end of file - int32 expected |
13 | Incorrect | 3 ms | 256 KB | Unexpected end of file - int32 expected |
14 | Incorrect | 3 ms | 384 KB | Unexpected end of file - int32 expected |