# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
63591 | 2018-08-02T08:40:04 Z | Bruteforceman | Zalmoxis (BOI18_zalmoxis) | C++11 | 1000 ms | 63340 KB |
#include <bits/stdc++.h> using namespace std; int a[1000010]; vector <int> v[1000010]; int alive[1000010]; int main(int argc, char const *argv[]) { int n, k; scanf("%d %d", &n, &k); for(int i = 1; i <= n; i++) { scanf("%d", &a[i]); alive[i] = 1; v[i].emplace_back(a[i]); } int sz = n; while(sz < n + k) { int opt = -1; for(int i = 1; i <= n; i++) { if(alive[i] == 1) { if(opt == -1 || a[opt] >= a[i]) { opt = i; } } } if(a[opt] == 30) break; int prev = -1; for(int i = opt - 1; i >= 1; i--) { if(alive[i] == 1) { prev = i; break; } } if(prev == -1 || a[prev] > a[opt]) { v[opt].emplace_back(a[opt]); ++a[opt]; ++sz; } else { alive[prev] = 0; ++a[opt]; } } for(int i = 1; i <= n; i++) { vector <int> tmp; while(v[i].size() > 1 && sz < n + k) { if(v[i].back() > 1) { int x = v[i].back(); v[i].pop_back(); v[i].emplace_back(x - 1); v[i].emplace_back(x - 1); ++sz; } else { v[i].pop_back(); tmp.emplace_back(1); } } for(auto j : tmp) { v[i].emplace_back(j); } for(auto j : v[i]) { printf("%d ", j); } } printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1083 ms | 62968 KB | Time limit exceeded |
2 | Execution timed out | 1081 ms | 63044 KB | Time limit exceeded |
3 | Execution timed out | 1062 ms | 63052 KB | Time limit exceeded |
4 | Execution timed out | 1090 ms | 63052 KB | Time limit exceeded |
5 | Execution timed out | 1083 ms | 63092 KB | Time limit exceeded |
6 | Execution timed out | 1084 ms | 63296 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1086 ms | 63296 KB | Time limit exceeded |
2 | Execution timed out | 1091 ms | 63340 KB | Time limit exceeded |
3 | Execution timed out | 1083 ms | 63340 KB | Time limit exceeded |
4 | Execution timed out | 1094 ms | 63340 KB | Time limit exceeded |
5 | Execution timed out | 1092 ms | 63340 KB | Time limit exceeded |
6 | Execution timed out | 1087 ms | 63340 KB | Time limit exceeded |
7 | Execution timed out | 1095 ms | 63340 KB | Time limit exceeded |
8 | Execution timed out | 1087 ms | 63340 KB | Time limit exceeded |
9 | Execution timed out | 1092 ms | 63340 KB | Time limit exceeded |
10 | Execution timed out | 1089 ms | 63340 KB | Time limit exceeded |
11 | Execution timed out | 1057 ms | 63340 KB | Time limit exceeded |
12 | Incorrect | 174 ms | 63340 KB | not a zalsequence |
13 | Incorrect | 175 ms | 63340 KB | not a zalsequence |
14 | Correct | 159 ms | 63340 KB | Output is correct |