Submission #1285720

#TimeUsernameProblemLanguageResultExecution timeMemory
1285720ggillianjiangDancing Elephants (IOI11_elephants)C++20
0 / 100
1 ms336 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]);
  }

  loop(M){
    update(1,2);
  }

}

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++;
}

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: In function 'int update(int, int)':
elephants.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
   51 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...