Submission #294541

#TimeUsernameProblemLanguageResultExecution timeMemory
294541DovranMechanical 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, c[N];

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

Compilation message (stderr)

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:20:6: error: no match for 'operator[]' (operand types are 'int [200009]' and 'std::vector<int>')
   20 |   vis[a]=1;
      |      ^
doll.cpp:19:11: warning: unused variable 'i' [-Wunused-variable]
   19 |  for(auto i:a)
      |           ^