Submission #14045

# Submission time Handle Problem Language Result Execution time Memory
14045 2015-04-25T15:41:34 Z jinmo123 이상한 수열 (OJUZ10_bizarre) C++
24 / 100
1000 ms 3036 KB
#include <stdio.h>
#include <stdlib.h>

#define MAX 2000000
#define DEBUG 0

char hashtable[MAX + 1]; // 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;
    char *h = &hashtable[b + MAX / 2];
    if(!*h) { *h = 1; n++; }
#if DEBUG
    if(!*h) { n++; hash *c=(hash *)malloc(sizeof(hash)); c->val = b; c->next = 0; *h = c; } // gee, need to initialize.
    else {
      hash *cur_h = *h;
      hash *prev_h;
      char found = 0;
      while(cur_h) {
        if(cur_h->val == b) {
          found = 1;
          break;
        }
        prev_h = cur_h;
        cur_h = cur_h->next;
      }
      if(!found) {
        cur_h = (hash *)malloc(sizeof(hash));
        cur_h->val = b;
        cur_h->next = 0;
        prev_h->next = cur_h;
        n++;
      }
    }
#endif
  }
  printf("%d", b);
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 3036 KB Output isn't correct
2 Incorrect 0 ms 3036 KB Output isn't correct
3 Incorrect 0 ms 3036 KB Output isn't correct
4 Incorrect 0 ms 3036 KB Output isn't correct
5 Incorrect 0 ms 3036 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 3036 KB Output is correct
2 Correct 0 ms 3036 KB Output is correct
3 Correct 0 ms 3036 KB Output is correct
4 Correct 0 ms 3036 KB Output is correct
5 Correct 0 ms 3036 KB Output is correct
6 Correct 0 ms 3036 KB Output is correct
7 Correct 0 ms 3036 KB Output is correct
8 Correct 0 ms 3036 KB Output is correct
9 Correct 0 ms 3036 KB Output is correct
10 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 3036 KB Output is correct
2 Incorrect 7 ms 3036 KB Output isn't correct
3 Incorrect 0 ms 3036 KB Output isn't correct
4 Incorrect 9 ms 3036 KB Output isn't correct
5 Correct 3 ms 3036 KB Output is correct
6 Correct 1 ms 3036 KB Output is correct
7 Correct 1 ms 3036 KB Output is correct
8 Incorrect 7 ms 3036 KB Output isn't correct
9 Correct 5 ms 3036 KB Output is correct
10 Incorrect 10 ms 3036 KB Output isn't correct
11 Correct 5 ms 3036 KB Output is correct
12 Correct 3 ms 3036 KB Output is correct
13 Correct 9 ms 3036 KB Output is correct
14 Incorrect 4 ms 3036 KB Output isn't correct
15 Correct 0 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 664 ms 3036 KB Output is correct
2 Execution timed out 1000 ms 3036 KB Program timed out
3 Incorrect 82 ms 3036 KB Output isn't correct
4 Incorrect 594 ms 3036 KB Output isn't correct
5 Correct 155 ms 3036 KB Output is correct
6 Incorrect 40 ms 3036 KB Output isn't correct
7 Correct 506 ms 3036 KB Output is correct
8 Incorrect 112 ms 3036 KB Output isn't correct
9 Execution timed out 1000 ms 3036 KB Program timed out
10 Incorrect 617 ms 3036 KB Output isn't correct
11 Execution timed out 1000 ms 3036 KB Program timed out
12 Incorrect 557 ms 3036 KB Output isn't correct
13 Correct 480 ms 3036 KB Output is correct
14 Correct 178 ms 3036 KB Output is correct
15 Correct 988 ms 3036 KB Output is correct