Submission #294532

#TimeUsernameProblemLanguageResultExecution timeMemory
294532DovranMechanical Doll (IOI18_doll)C++11
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "doll.h"

#define N 200009
#define pii pair <int, int>
#define ff first
#define ss second
#define pb push_back
#define ll long long

using namespace std;

int n;

create_circuit(int m, vector<int>a){
	n=a.size();
	vector<int>e, b;
	int x=0;
	for(int i=0; i<n-1; i++)
		c[x]=a[i], x=a[i];
	
	for(int i=0; i<m; i++)
		if(!c[i])
			c[x]=i, x=i;
	c[x]=0;
	for(int i=0; i<m; i++)
		e.pb(c[i]);
	answer(c, b, b);
}

Compilation message (stderr)

doll.cpp:15:1: error: ISO C++ forbids declaration of 'create_circuit' with no type [-fpermissive]
   15 | create_circuit(int m, vector<int>a){
      | ^~~~~~~~~~~~~~
doll.cpp:15:1: error: ambiguating new declaration of 'int create_circuit(int, std::vector<int>)'
In file included from doll.cpp:2:
doll.h:5:6: note: old declaration 'void create_circuit(int, std::vector<int>)'
    5 | void create_circuit(int M, std::vector<int> A);
      |      ^~~~~~~~~~~~~~
doll.cpp: In function 'int create_circuit(int, std::vector<int>)':
doll.cpp:20:3: error: 'c' was not declared in this scope
   20 |   c[x]=a[i], x=a[i];
      |   ^
doll.cpp:23:7: error: 'c' was not declared in this scope
   23 |   if(!c[i])
      |       ^
doll.cpp:25:2: error: 'c' was not declared in this scope
   25 |  c[x]=0;
      |  ^
doll.cpp:29:1: warning: no return statement in function returning non-void [-Wreturn-type]
   29 | }
      | ^