| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1315616 | cosminvixtor | Global Warming (NOI13_gw) | C11 | 1095 ms | 8160 KiB |
#include <stdio.h>
#include <stdlib.h>
void bubble_sort(int *A,int n) {
int i,chair,done;
do {
done=1;
for (i=1;i<n;i++) {
if (A[i]>A[i+1]) {
chair=A[i];
A[i]=A[i+1];
A[i+1]=chair;
done=0;
}
}
} while (!done);
}
int main() {
int *L,*S,n,i,j,height,islands,maxislands,sealevel,minl,maxl;
scanf("%d",&n);
L=(int*)calloc(n+1,sizeof(int));
S=(int*)calloc(n+1,sizeof(int));
scanf("%d",L+1);
minl=L[1]; maxl=L[1];
S[1]=L[1];
for (i=2;i<=n;i++) {
scanf("%d",L+i);
if (L[i]<minl) minl=L[i];
else if (L[i]>maxl) maxl=L[i];
S[i]=L[i];
}
bubble_sort(S,n);
maxislands=0;
for (i=0;i<=n;i++) {
sealevel=S[i];
if (n-i<=maxislands) break;
else {
islands=0;
for (j=1;j<=n;j++) {
if (L[j]>sealevel && L[j-1]<=sealevel) {
islands++;
}
}
if (islands>maxislands) maxislands=islands;
}
}
printf("%d\n",maxislands);
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
