#include <bits/stdc++.h>
#define DIM 1000010
using namespace std;
int v[DIM];
int n,k,i,sol,sol_poz;
int solve (int nr, int idx) {
if (v[idx] == nr)
return idx + 1;
if (!nr)
return 0;
nr--;
int p = solve (nr, idx);
if (p > n || v[p] > nr) {
sol_poz = p-1;
sol = nr;
return p;
}
return solve (nr, p);
}
int main() {
int i;
// ifstream cin ("zalmoxis.in");
//ofstream cout ("zalmoxis.out");
cin>>n>>k;
for (i = 1; i <= n; i++)
cin>>v[i];
solve (30, 1);
for (i=1;i<=n;i++) {
cout<<v[i]<<" ";
if (i == sol_poz)
cout<<sol<<" ";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
300 ms |
8312 KB |
Output is correct |
2 |
Correct |
297 ms |
8440 KB |
Output is correct |
3 |
Correct |
307 ms |
8440 KB |
Output is correct |
4 |
Correct |
319 ms |
8440 KB |
Output is correct |
5 |
Correct |
310 ms |
8440 KB |
Output is correct |
6 |
Correct |
305 ms |
8312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
307 ms |
8312 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
299 ms |
8312 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
309 ms |
8440 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
307 ms |
8440 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
300 ms |
8440 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
296 ms |
8312 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
306 ms |
8440 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
313 ms |
8440 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
244 ms |
6776 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
99 ms |
2808 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
156 ms |
4344 KB |
Unexpected end of file - int32 expected |
12 |
Incorrect |
5 ms |
256 KB |
Unexpected end of file - int32 expected |
13 |
Incorrect |
5 ms |
256 KB |
Unexpected end of file - int32 expected |
14 |
Incorrect |
5 ms |
256 KB |
Unexpected end of file - int32 expected |