| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 738430 | Olympia | Logičari (COCI21_logicari) | C++17 | 149 ms | 2892 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int deg[N];
for (int i = 0; i < N; i++) {
deg[i] = 0;
}
for (int i = 0; i < N; i++) {
int u, v; cin >> u >> v; --u; --v;
edges.emplace_back(u, v);
deg[u]++, deg[v]++;
}
bool s1 = true;
for (int i = 0; i < N; i++) {
s1 &= (deg[i] == 2);
}
if (s1) {
if (N % 4 == 0) {
cout << N/2;
} else {
cout << -1;
}
exit(0);
}
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;
}
컴파일 시 표준 에러 (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... | ||||
