Strange Compile Error
Posted: Sun Aug 06, 2006 11:12 am
During the last contest I submitted the code attached at the end.
The Compile Error reported to me by UVA was (in the notification email)
The Compile Error reported to me by UVA was (in the notification email)
This is not the correct error. Now, after the contest, I receive the correct one:g++: 00003755_PC.c: No such file or directory
g++: No input files
Why are the errors during the contest different? In my opinion at least compile errors should be reported correctly, because not everyone can set up the compiler used by the judge.04799290_24.c: In function `int cmp(const void *, const void *)':
04799290_24.c:28: implicit declaration of function `int strcasecmp(...)'
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
struct pilot_t {
char name[100];
int x, y, z;
} pilots[110];
int cmp(const void *a, const void *b)
{
pilot_t *l = (pilot_t *) a, *r = (pilot_t *) b;
if (l->x != r->x) return l->x - r->x;
if (l->y != r->y) return l->y - r->y;
if (l->z != r->z) return l->z - r->z;
return strcasecmp(l->name, r->name);
}
int main()
{
int n, i;
while (scanf("%d", &n) == 1) {
if (n == 0) break;
for (i = 0; i < n; i++) {
assert(scanf("%s : %d min %d sec %d ms", pilots[i].name, &pilots[i].x, &pilots[i].y, &pilots[i].z) == 4);
assert(pilots[i].x >= 0 && pilots[i].x < 60);
assert(pilots[i].y >= 0 && pilots[i].y < 60);
assert(pilots[i].z >= 0 && pilots[i].z < 1000);
/*for (int j = 0; j < (int) strlen(pilots[i].name); j++) {
assert(pilots[i].name[j] >= 'A' && pilots[i].name[j] <= 'Z'
|| pilots[i].name[j] >= 'a' && pilots[i].name[j] <= 'z');
}*/
}
qsort(pilots, n, sizeof(pilot_t), cmp);
for (i = 0; i < n; i++) {
if (i % 2 == 0) {
printf("Row %d\n", i / 2 + 1);
}
printf("%s\n", pilots[i].name);
}
printf("\n");
}
return 0;
}