Submission #499543

# Submission time Handle Problem Language Result Execution time Memory
499543 2021-12-28T15:14:22 Z adam Kutije (COCI21_kutije) C++14
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
int m = 1005;
vector<int>g[m];
bool p[m];
int c[m];
void q(int v, int no) {
	p[v] = 1;
	c[v] = no;
	for(auto u : g[v]) if(!p[u]) {
		q(u, no);
	}
}
void y() {
	int n, m, q; cin >> n >> m >> q;
	while(m--) {
		for(int i=1; i<=n; ++i) {
			int to; cin >> to;
			g[i].push_back(to);
			g[to].push_back(i);
		}
	}
	int cur = 1;
	for(int i=1; i<=n; ++i) if(!p[i]) {
		DFS(i, cur);
		++cur;
	}
	while(q--) {
		int a, b; cin >> a >> b;
		if(c[a]==c[b]) {
			cout << "DA";
		} else {
			cout << "NE";
		}
	}
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	y();
	return 0;
}

Compilation message

Main.cpp:4:15: error: array bound is not an integer constant before ']' token
    4 | vector<int>g[m];
      |               ^
Main.cpp:5:9: error: array bound is not an integer constant before ']' token
    5 | bool p[m];
      |         ^
Main.cpp:6:8: error: array bound is not an integer constant before ']' token
    6 | int c[m];
      |        ^
Main.cpp: In function 'void q(int, int)':
Main.cpp:8:2: error: 'p' was not declared in this scope
    8 |  p[v] = 1;
      |  ^
Main.cpp:9:2: error: 'c' was not declared in this scope
    9 |  c[v] = no;
      |  ^
Main.cpp:10:15: error: 'g' was not declared in this scope
   10 |  for(auto u : g[v]) if(!p[u]) {
      |               ^
Main.cpp: In function 'void y()':
Main.cpp:19:4: error: 'g' was not declared in this scope
   19 |    g[i].push_back(to);
      |    ^
Main.cpp:24:30: error: 'p' was not declared in this scope
   24 |  for(int i=1; i<=n; ++i) if(!p[i]) {
      |                              ^
Main.cpp:25:3: error: 'DFS' was not declared in this scope
   25 |   DFS(i, cur);
      |   ^~~
Main.cpp:30:6: error: 'c' was not declared in this scope
   30 |   if(c[a]==c[b]) {
      |      ^