Submission #23123

# Submission time Handle Problem Language Result Execution time Memory
23123 2017-05-03T10:23:02 Z model_code Calvinball championship (CEOI15_teams) C
20 / 100
1000 ms 1812 KB
#include <stdio.h>

#define MAXN 10000
#define MP 1000007

static int n, seq[MAXN];

static int
gen_part_until (int len_gen, int max_part, int matches, int *seen)
{
  int p;

  if (len_gen == n)
    {
      *seen = ((*seen + 1) % MP);
      return matches;
    }

  for (p = 1; p <= max_part; p++)
    if (gen_part_until (len_gen + 1, max_part, matches && seq[len_gen] == p, seen))
      return 1;

  return gen_part_until (len_gen + 1, max_part + 1, matches && seq[len_gen] == max_part + 1, seen);
}

int main (void)
{
  int i, k = 0;

  scanf ("%d", &n);

  for (i = 0; i < n; i++)
    scanf ("%d", &seq[i]);

  gen_part_until (0, 0, 1, &k);

  printf ("%d\n", k);
  return 0;
}

Compilation message

teams.c: In function 'main':
teams.c:30:3: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   scanf ("%d", &n);
   ^
teams.c:33:5: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d", &seq[i]);
     ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1156 KB Output is correct
2 Correct 0 ms 1156 KB Output is correct
3 Correct 0 ms 1156 KB Output is correct
4 Correct 0 ms 1156 KB Output is correct
5 Correct 0 ms 1156 KB Output is correct
6 Correct 0 ms 1156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1156 KB Output is correct
2 Correct 0 ms 1156 KB Output is correct
3 Correct 0 ms 1156 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 109 ms 1156 KB Output is correct
2 Correct 0 ms 1156 KB Output is correct
3 Execution timed out 1000 ms 1156 KB Execution timed out
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1156 KB Execution timed out
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1156 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1156 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1156 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1800 KB Execution timed out
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1420 KB Execution timed out
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1000 ms 1812 KB Execution timed out
2 Halted 0 ms 0 KB -