Submission #1285722

#TimeUsernameProblemLanguageResultExecution timeMemory
1285722ggillianjiangDancing Elephants (IOI11_elephants)C++20
Compilation error
0 ms0 KiB
#include "elephants.h" #include <cstdio> #include <vector> #include <utility> using namespace std; #define loop(s) for(int a = 0; a < s; ++a) using vec_t = vector<int>; using p_t = pair<int, pair<int, int> >; using vp_t = vector< p_t >; using vv_t = vector< vector<int> >; int n, l, least; vec_t x; vec_t pos; vp_t cameras; vv_t frames; void init(int N, int L, int X[]) { int M; n=N; l=L; loop(sizeof(X)/sizeof(X[0])){ frames[X[a]/l].push_back(X[a]); if(X[a]/l != X[a-1]/l) least++; } printf("%d", least); loop(M){ update(); } } int update(int i, int y) { bool empty; loop(frames[i/l].size()){ if(frames[i/l][a]==-1) continue; else if(frames[i/l][a]==i && a==frames[i/l].size()-1) frames[i/l].pop_back(); else if(frames[i/l][a]==i) frames[i/l][a] = -1; else empty = false; } if(empty) least--; frames[y/l].push_back(y); if(frames[y/l]!=frames[i/l]) least++; printf("%d", least); }

Compilation message (stderr)

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:26:15: warning: 'sizeof' on array function parameter 'X' will return size of 'int*' [-Wsizeof-array-argument]
   26 |   loop(sizeof(X)/sizeof(X[0])){
      |              ~^~
elephants.cpp:8:36: note: in definition of macro 'loop'
    8 | #define loop(s) for(int a = 0; a < s; ++a)
      |                                    ^
elephants.cpp:20:29: note: declared here
   20 | void init(int N, int L, int X[])
      |                         ~~~~^~~
elephants.cpp:34:11: error: too few arguments to function 'int update(int, int)'
   34 |     update();
      |     ~~~~~~^~
In file included from elephants.cpp:1:
elephants.h:2:5: note: declared here
    2 | int update(int i, int y);
      |     ^~~~~~
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:56:1: warning: no return statement in function returning non-void [-Wreturn-type]
   56 | }
      | ^