Submission #578222

# Submission time Handle Problem Language Result Execution time Memory
578222 2022-06-16T08:42:15 Z kingfran1907 Stranded Far From Home (BOI22_island) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
const int maxn = 2010;

int n, m;
int niz[maxn];
vector< int > graph[maxn];
bool bio[maxn];

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) 
		scanf("%d", niz+i);
		
	for (int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		graph[a].push_back(b);
		graph[b].push_back(a);
	}
	
	for (int i = 1; i <= n; i++) {
		llint sum = niz[i];
		set< pair<int, int> > s;
		memset(bio, false, sizeof bio);
		
		bio[i] = true;
		for (int tren : graph[i]) {
			s.insert({niz[tren], tren});
		}
		
		while (!s.empty()) {
			int x = s.begin()->second;
			int val = s.begin()->first;
			if (val > sum) break;
			
			s.erase(s.begin());
			if (bio[x]) continue;
			bio[x] = true;
			sum += val;
			for (int tren : graph[x]) 
				if (!bio[tren]) s.insert({niz[tren], tren});
		}
		printf("%d", s.empty());
	}
	return 0;
}

Compilation message

island.cpp: In function 'int main()':
island.cpp:24:3: error: 'llint' was not declared in this scope; did you mean 'lrint'?
   24 |   llint sum = niz[i];
      |   ^~~~~
      |   lrint
island.cpp:36:14: error: 'sum' was not declared in this scope
   36 |    if (val > sum) break;
      |              ^~~
island.cpp:41:4: error: 'sum' was not declared in this scope
   41 |    sum += val;
      |    ^~~
island.cpp:12:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%d%d", &n, &m);
      |  ~~~~~^~~~~~~~~~~~~~~~
island.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   14 |   scanf("%d", niz+i);
      |   ~~~~~^~~~~~~~~~~~~
island.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |   scanf("%d%d", &a, &b);
      |   ~~~~~^~~~~~~~~~~~~~~~