# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1108085 |
2024-11-02T17:41:16 Z |
vicvic |
Zalmoxis (BOI18_zalmoxis) |
C++11 |
|
1000 ms |
54732 KB |
#include <iostream>
#include <fstream>
#include <cassert>
using namespace std;
ifstream f ("zalmoxis.in");
ofstream g ("zalmoxis.out");
int n, k, v[2000005], poz, added[2000005], s[2000005], cnt;
void descp (int j)
{
if (j<=1)
{
g << j << " ";
}
else if (k)
{
k--;
descp (j-1);
descp (j-1);
}
else g << j << " ";
}
int main()
{
f >> n >> k;
int poz=0, adaugate=0;
for (int i=1;i<=n;i++)
{
int x;
f >> x;
int ok=0;
while (cnt && s[cnt]<x)
{
v[++poz]=s[cnt];
adaugate++;
int val=v[poz];
while (cnt && val==s[cnt])
{
cnt--;
val++;
}
s[++cnt]=val;
added[poz]=1;
}
v[++poz]=x;
while (cnt && x==s[cnt])
{
cnt--;
x++;
}
s[++cnt]=x;
}
while (s[cnt]!=30)
{
adaugate++;
v[++poz]=s[cnt];
added[poz]=1;
int val=v[poz];
while (cnt && s[cnt]==val)
{
cnt--;
val++;
}
s[++cnt]=val;
}
k-=adaugate;
int t=0;
for (int i=1;i<=poz;i++)
{
if (added[poz])
{
descp (v[i]);
}
else g << v[i] << " ";
}
return 0;
}
Compilation message
zalmoxis.cpp: In function 'int main()':
zalmoxis.cpp:30:13: warning: unused variable 'ok' [-Wunused-variable]
30 | int ok=0;
| ^~
zalmoxis.cpp:66:9: warning: unused variable 't' [-Wunused-variable]
66 | int t=0;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1045 ms |
50912 KB |
Time limit exceeded |
2 |
Execution timed out |
1058 ms |
49920 KB |
Time limit exceeded |
3 |
Execution timed out |
1088 ms |
49176 KB |
Time limit exceeded |
4 |
Execution timed out |
1060 ms |
49336 KB |
Time limit exceeded |
5 |
Execution timed out |
1086 ms |
51432 KB |
Time limit exceeded |
6 |
Execution timed out |
1066 ms |
49220 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1067 ms |
49268 KB |
Time limit exceeded |
2 |
Execution timed out |
1070 ms |
51924 KB |
Time limit exceeded |
3 |
Execution timed out |
1070 ms |
52040 KB |
Time limit exceeded |
4 |
Execution timed out |
1075 ms |
49468 KB |
Time limit exceeded |
5 |
Execution timed out |
1070 ms |
51280 KB |
Time limit exceeded |
6 |
Execution timed out |
1052 ms |
49480 KB |
Time limit exceeded |
7 |
Execution timed out |
1040 ms |
51360 KB |
Time limit exceeded |
8 |
Execution timed out |
1063 ms |
49736 KB |
Time limit exceeded |
9 |
Execution timed out |
1068 ms |
48932 KB |
Time limit exceeded |
10 |
Execution timed out |
1066 ms |
48692 KB |
Time limit exceeded |
11 |
Execution timed out |
1045 ms |
45608 KB |
Time limit exceeded |
12 |
Execution timed out |
1075 ms |
53196 KB |
Time limit exceeded |
13 |
Execution timed out |
1097 ms |
54732 KB |
Time limit exceeded |
14 |
Execution timed out |
1065 ms |
52296 KB |
Time limit exceeded |