Submission #228665

# Submission time Handle Problem Language Result Execution time Memory
228665 2020-05-02T09:58:56 Z Cantfindme Ronald (COCI17_ronald) C++17
105 / 120
50 ms 10232 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pi;
#define f first
#define s second
#define FAST ios_base::sync_with_stdio(0); cin.tie(0);
const int maxn = 1010;

int n,e;
int edge[maxn][maxn];

int visited[maxn];
vector <int> v;
void test(int x) {
	if (visited[x]) return;
	visited[x] = 1;
	v.push_back(x);
	
	for (int i =1;i<=n;i++) {
		if (edge[x][i]) test(i);
	}
}


int32_t main() {
	FAST
	cin >> n >> e;
	for (int i =0;i<e;i++) {
		int a,b; cin >> a >> b;
		edge[a][b] = edge[b][a] = 1;
	}
	
	
	bool fail = false;
	for (int x =1;x<=n;x++) {
		if (!visited[x]) test(x);
		
		for (auto i: v) {
			for (auto j: v) {
				if (i == j) continue;
				if (!edge[i][j]) fail = true;
			}
		}
		
		v.clear();
	}
	
	
	if (fail) cout << "NE";
	else cout << "DA";
	
}

# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 512 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 6 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 5 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 640 KB Output is correct
2 Correct 6 ms 640 KB Output is correct
3 Correct 6 ms 896 KB Output is correct
4 Correct 5 ms 768 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 1536 KB Output is correct
2 Correct 16 ms 4736 KB Output is correct
3 Correct 9 ms 2432 KB Output is correct
4 Correct 9 ms 2304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1536 KB Output is correct
2 Correct 16 ms 4608 KB Output is correct
3 Correct 41 ms 9592 KB Output is correct
4 Correct 50 ms 10232 KB Output is correct