Submission #46936

#TimeUsernameProblemLanguageResultExecution timeMemory
46936model_codeSoccer (JOI17_soccer)C11
Compilation error
0 ms0 KiB
#include <stdio.h> int main() { const int n = 10; int a[n] = {16,12,17,48,89,21,97,59,30,16}; int i, j, t, res=0; for (i = 0; i < n; i++){ for (j = i + 1; j < n; j++){ if (a[i] > a[j]){ t = a[i]; a[i] = a[j]; a[j] = t; } } } printf ("%d\n",a[2]); }

Compilation message (stderr)

soccer.c: In function 'main':
soccer.c:4:1: error: variable-sized object may not be initialized
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
 ^~~
soccer.c:4:13: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
             ^~
soccer.c:4:13: note: (near initialization for 'a')
soccer.c:4:16: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                ^~
soccer.c:4:16: note: (near initialization for 'a')
soccer.c:4:19: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                   ^~
soccer.c:4:19: note: (near initialization for 'a')
soccer.c:4:22: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                      ^~
soccer.c:4:22: note: (near initialization for 'a')
soccer.c:4:25: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                         ^~
soccer.c:4:25: note: (near initialization for 'a')
soccer.c:4:28: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                            ^~
soccer.c:4:28: note: (near initialization for 'a')
soccer.c:4:31: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                               ^~
soccer.c:4:31: note: (near initialization for 'a')
soccer.c:4:34: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                                  ^~
soccer.c:4:34: note: (near initialization for 'a')
soccer.c:4:37: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                                     ^~
soccer.c:4:37: note: (near initialization for 'a')
soccer.c:4:40: warning: excess elements in array initializer
 int a[n] = {16,12,17,48,89,21,97,59,30,16};
                                        ^~
soccer.c:4:40: note: (near initialization for 'a')
soccer.c:5:14: warning: unused variable 'res' [-Wunused-variable]
 int i, j, t, res=0;
              ^~~