# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
738418 | Olympia | Logičari (COCI21_logicari) | C++17 | 166 ms | 2640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <set>
#include <cmath>
#include <queue>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <map>
#include <deque>
#include <stdio.h>
using namespace std;
int new_max (int a, int b) {
if (a == -1) return b;
if (b == -1) return a;
return max(a, b);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
vector<pair<int,int>> edges;
for (int i = 0; i < N; i++) {
int u, v; cin >> u >> v; --u; --v;
edges.emplace_back(u, v);
}
int lst = -1;
for (int i = 0; i < (1 << N); i++) {
vector<int> cnt;
cnt.assign(N, 0);
for (auto& p: edges) {
if (i & (1 << p.first)) cnt[p.second]++;
if (i & (1 << p.second)) cnt[p.first]++;
}
bool fine = true;
for (int i = 0; i < cnt.size(); i++) {
fine &= (cnt[i] == 1);
}
if (fine) {
lst = new_max(lst, __builtin_popcount(i));
}
}
cout << lst;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |