#include <stdio.h>
#include <stdlib.h>
typedef struct _hash {
int val;
struct _hash *next;
} hash;
hash *hashtable[1415]; // LOL, initial value is 0! initial size is sizeof(void *) * 1415!
int main() {
int N, b;
scanf("%d", &N);
int i;
int n = 0;
char is_lower_than_N = 1;
for(i = 0; i < N; i++) {
if(is_lower_than_N) { scanf("%d", &b); if(i == N - 1) { scanf("%d", &N); is_lower_than_N = 0; } }
else b = n;
hash **h = &hashtable[b % 1415];
if(!*h) { n++; *h=(hash *)malloc(sizeof(hash)); (*h)->val = b; (*h)->next = 0; } // gee, need to initialize.
else {
hash *cur_h = *h;
char found = 0;
while(cur_h) {
if(cur_h->val == b) {
found = 1;
break;
}
cur_h = cur_h->next;
}
if(!found) n++;
}
}
printf("%d", b);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
3 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
4 |
Incorrect |
0 ms |
1092 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
1092 KB |
Output isn't correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
3 |
Correct |
0 ms |
1092 KB |
Output is correct |
4 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
5 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
6 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
10 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
3 |
Correct |
4 ms |
1092 KB |
Output is correct |
4 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
5 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
6 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
10 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
11 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
12 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
13 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
14 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
15 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
2 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
3 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
4 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
5 |
Execution timed out |
1000 ms |
1088 KB |
Program timed out |
6 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
7 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
8 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
9 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
10 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
11 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
12 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
13 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
14 |
Runtime error |
0 ms |
1088 KB |
SIGSEGV Segmentation fault |
15 |
Correct |
389 ms |
1092 KB |
Output is correct |