Submission #110933

# Submission time Handle Problem Language Result Execution time Memory
110933 2019-05-13T08:08:46 Z imsifile On the Grid (FXCUP4_grid) C++
Compilation error
0 ms 0 KB
#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

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