Submission #110933

#TimeUsernameProblemLanguageResultExecution timeMemory
110933imsifileOn the Grid (FXCUP4_grid)C++98
Compilation error
0 ms0 KiB
#include "grid.h" #include <vector> #include <stdio.h> using namespace std; int N, rot[1010], sm[1010]; int Put(){ vector<int> v; for(int i=0; i<N; i++) v.push_back(rot[i]); return PutDisks(v)-N; } void Rotate(int X){ int tmp=rot[0]; for(int i=0; i<X-1; i++) rot[i]=rot[i+1]; rot[X-1]=tmp; } void SortDisks(int N_) { N = N_; for(int i=0; i<N; i++) rot[i]=i+1; for(int i=N; i>1; i--){ while(1){ int x = Put(); Rotate(i); if(x == i-1) break; } } for(int i=0; i<N; i++) sm[rot[i]]=i+1; for(int i=1; i<=N; i++) Report(sm[i]); }

Compilation message (stderr)

grid.cpp: In function 'void SortDisks(int)':
grid.cpp:19:6: error: ambiguating new declaration of 'void SortDisks(int)'
 void SortDisks(int N_) {
      ^~~~~~~~~
In file included from grid.cpp:1:0:
grid.h:7:18: note: old declaration 'std::vector<int> SortDisks(int)'
 std::vector<int> SortDisks(int N);
                  ^~~~~~~~~
grid.cpp:30:26: error: 'Report' was not declared in this scope
  for(int i=1; i<=N; i++) Report(sm[i]);
                          ^~~~~~
grid.cpp:30:26: note: suggested alternative: 'short'
  for(int i=1; i<=N; i++) Report(sm[i]);
                          ^~~~~~
                          short