Submission #111964

#TimeUsernameProblemLanguageResultExecution timeMemory
111964mechfrog88Memory 2 (JOI16_memory2)C++14
Compilation error
0 ms0 KiB
struct s{ ll num; ll times; bool operator <(const s& rhs) const { return times < rhs.times; } }; void Solve(int T, int N){ vector <ll> num(N,0); for (int x=0;x<N;x++){ for (int z=0;z<N;z++){ num[Flip(z,z+1)]++; } } vector <s> arr(N); for (int z=0;z<N;z++){ arr[z].num = z; arr[z].times = num[z]; } sort(arr.begin(),arr.end()); vector <ll> visited(N,false); for (int z=0;z<arr.size();z++){ for (int x=0;x<N;x++){ ll next = x+1; while (visited[next]){ next++; } if (Flip(x,next) == arr[z].num){ Answer(x,next,arr[z].num); visited[x] = true; visited[next] = true; } } } return; }

Compilation message (stderr)

memory2.cpp:2:2: error: 'll' does not name a type
  ll num;
  ^~
memory2.cpp:3:2: error: 'll' does not name a type
  ll times;
  ^~
memory2.cpp: In member function 'bool s::operator<(const s&) const':
memory2.cpp:5:10: error: 'times' was not declared in this scope
   return times < rhs.times;
          ^~~~~
memory2.cpp:5:22: error: 'const struct s' has no member named 'times'
   return times < rhs.times;
                      ^~~~~
memory2.cpp: In function 'void Solve(int, int)':
memory2.cpp:10:2: error: 'vector' was not declared in this scope
  vector <ll> num(N,0);
  ^~~~~~
memory2.cpp:10:10: error: 'll' was not declared in this scope
  vector <ll> num(N,0);
          ^~
memory2.cpp:10:14: error: 'num' was not declared in this scope
  vector <ll> num(N,0);
              ^~~
memory2.cpp:10:14: note: suggested alternative: 'enum'
  vector <ll> num(N,0);
              ^~~
              enum
memory2.cpp:13:8: error: 'Flip' was not declared in this scope
    num[Flip(z,z+1)]++;
        ^~~~
memory2.cpp:16:11: error: expected primary-expression before '>' token
  vector <s> arr(N);
           ^
memory2.cpp:16:13: error: 'arr' was not declared in this scope
  vector <s> arr(N);
             ^~~
memory2.cpp:21:2: error: 'sort' was not declared in this scope
  sort(arr.begin(),arr.end());
  ^~~~
memory2.cpp:21:2: note: suggested alternative: 'short'
  sort(arr.begin(),arr.end());
  ^~~~
  short
memory2.cpp:22:14: error: 'visited' was not declared in this scope
  vector <ll> visited(N,false);
              ^~~~~~~
memory2.cpp:25:7: error: expected ';' before 'next'
    ll next = x+1;
       ^~~~
memory2.cpp:26:19: error: 'next' was not declared in this scope
    while (visited[next]){
                   ^~~~
memory2.cpp:29:15: error: 'next' was not declared in this scope
    if (Flip(x,next) == arr[z].num){
               ^~~~
memory2.cpp:29:8: error: 'Flip' was not declared in this scope
    if (Flip(x,next) == arr[z].num){
        ^~~~
memory2.cpp:30:5: error: 'Answer' was not declared in this scope
     Answer(x,next,arr[z].num);
     ^~~~~~