#include<iostream>
//TO BE OPTIMIZED -> too much time (3 for loops);
using namespace std;
int main(){
long long n; cin >> n;
int arr[n];
//int col = -1; //current color
for(int i=0;i<n;i++){
cin >> arr[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(arr[i] == arr[j]){
for(int l=i;l<j;l++){
arr[l] = arr[i];
}
}
}
}
for(int i=0;i<n;i++){
cout << arr[i] << "\n";
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
446 ms |
592 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
437 ms |
412 KB |
Output is correct |
11 |
Correct |
439 ms |
432 KB |
Output is correct |
12 |
Correct |
452 ms |
592 KB |
Output is correct |
13 |
Correct |
447 ms |
592 KB |
Output is correct |
14 |
Correct |
459 ms |
592 KB |
Output is correct |
15 |
Correct |
449 ms |
416 KB |
Output is correct |
16 |
Correct |
436 ms |
344 KB |
Output is correct |
17 |
Correct |
2 ms |
344 KB |
Output is correct |
18 |
Correct |
2 ms |
344 KB |
Output is correct |
19 |
Correct |
445 ms |
428 KB |
Output is correct |
20 |
Correct |
449 ms |
544 KB |
Output is correct |
21 |
Correct |
438 ms |
344 KB |
Output is correct |
22 |
Correct |
431 ms |
344 KB |
Output is correct |
23 |
Correct |
434 ms |
432 KB |
Output is correct |
24 |
Correct |
442 ms |
432 KB |
Output is correct |
25 |
Correct |
447 ms |
344 KB |
Output is correct |
26 |
Correct |
432 ms |
592 KB |
Output is correct |
27 |
Correct |
449 ms |
416 KB |
Output is correct |
28 |
Correct |
432 ms |
592 KB |
Output is correct |
29 |
Correct |
57 ms |
428 KB |
Output is correct |
30 |
Correct |
430 ms |
428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
432 ms |
592 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
427 ms |
412 KB |
Output is correct |
10 |
Correct |
435 ms |
416 KB |
Output is correct |
11 |
Correct |
442 ms |
412 KB |
Output is correct |
12 |
Correct |
426 ms |
412 KB |
Output is correct |
13 |
Correct |
452 ms |
592 KB |
Output is correct |
14 |
Correct |
424 ms |
344 KB |
Output is correct |
15 |
Correct |
427 ms |
344 KB |
Output is correct |
16 |
Correct |
428 ms |
344 KB |
Output is correct |
17 |
Execution timed out |
2025 ms |
1368 KB |
Time limit exceeded |
18 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |
6 |
Correct |
446 ms |
592 KB |
Output is correct |
7 |
Correct |
0 ms |
344 KB |
Output is correct |
8 |
Correct |
1 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
344 KB |
Output is correct |
10 |
Correct |
437 ms |
412 KB |
Output is correct |
11 |
Correct |
439 ms |
432 KB |
Output is correct |
12 |
Correct |
452 ms |
592 KB |
Output is correct |
13 |
Correct |
447 ms |
592 KB |
Output is correct |
14 |
Correct |
459 ms |
592 KB |
Output is correct |
15 |
Correct |
449 ms |
416 KB |
Output is correct |
16 |
Correct |
436 ms |
344 KB |
Output is correct |
17 |
Correct |
2 ms |
344 KB |
Output is correct |
18 |
Correct |
2 ms |
344 KB |
Output is correct |
19 |
Correct |
445 ms |
428 KB |
Output is correct |
20 |
Correct |
449 ms |
544 KB |
Output is correct |
21 |
Correct |
438 ms |
344 KB |
Output is correct |
22 |
Correct |
431 ms |
344 KB |
Output is correct |
23 |
Correct |
434 ms |
432 KB |
Output is correct |
24 |
Correct |
442 ms |
432 KB |
Output is correct |
25 |
Correct |
447 ms |
344 KB |
Output is correct |
26 |
Correct |
432 ms |
592 KB |
Output is correct |
27 |
Correct |
449 ms |
416 KB |
Output is correct |
28 |
Correct |
432 ms |
592 KB |
Output is correct |
29 |
Correct |
57 ms |
428 KB |
Output is correct |
30 |
Correct |
430 ms |
428 KB |
Output is correct |
31 |
Correct |
1 ms |
348 KB |
Output is correct |
32 |
Correct |
0 ms |
348 KB |
Output is correct |
33 |
Correct |
0 ms |
344 KB |
Output is correct |
34 |
Correct |
0 ms |
344 KB |
Output is correct |
35 |
Correct |
432 ms |
592 KB |
Output is correct |
36 |
Correct |
1 ms |
344 KB |
Output is correct |
37 |
Correct |
1 ms |
344 KB |
Output is correct |
38 |
Correct |
1 ms |
344 KB |
Output is correct |
39 |
Correct |
427 ms |
412 KB |
Output is correct |
40 |
Correct |
435 ms |
416 KB |
Output is correct |
41 |
Correct |
442 ms |
412 KB |
Output is correct |
42 |
Correct |
426 ms |
412 KB |
Output is correct |
43 |
Correct |
452 ms |
592 KB |
Output is correct |
44 |
Correct |
424 ms |
344 KB |
Output is correct |
45 |
Correct |
427 ms |
344 KB |
Output is correct |
46 |
Correct |
428 ms |
344 KB |
Output is correct |
47 |
Execution timed out |
2025 ms |
1368 KB |
Time limit exceeded |
48 |
Halted |
0 ms |
0 KB |
- |