Submission #797565

#TimeUsernameProblemLanguageResultExecution timeMemory
797565XJP12수천개의 섬 (IOI22_islands)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
pair<bool,int[]> find_journey(int n, int m, int[] u, int[] v){
	bool ban=false;
	int ban1=0;
	for(int i=0; i<m; i++){
		if(u[i]==0){
			ban1++;
		}else{
			ban=true;
		}
	}
	int a[7];

	//return {ban, a};
	if(ban==false && ban1>1){
		a={0,1,0,1,0,1,0};
		return {true,a};
	}else{
		return {false,a};
	}
}

Compilation message (stderr)

islands.cpp:6:51: error: expected ',' or '...' before 'u'
    6 | pair<bool,int[]> find_journey(int n, int m, int[] u, int[] v){
      |                                                   ^
islands.cpp: In function 'std::pair<bool, int []> find_journey(int, int, int*)':
islands.cpp:10:6: error: 'u' was not declared in this scope
   10 |   if(u[i]==0){
      |      ^
islands.cpp:20:4: error: assigning to an array from an initializer list
   20 |   a={0,1,0,1,0,1,0};
      |   ~^~~~~~~~~~~~~~~~
islands.cpp:21:17: error: could not convert '{true, a}' from '<brace-enclosed initializer list>' to 'std::pair<bool, int []>'
   21 |   return {true,a};
      |                 ^
      |                 |
      |                 <brace-enclosed initializer list>
islands.cpp:23:18: error: could not convert '{false, a}' from '<brace-enclosed initializer list>' to 'std::pair<bool, int []>'
   23 |   return {false,a};
      |                  ^
      |                  |
      |                  <brace-enclosed initializer list>