# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
869545 | 2023-11-04T17:00:10 Z | JoksimKaktus | Logičari (COCI21_logicari) | C++17 | 35 ms | 7004 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; vector <int> adj[100010]; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0); int n; cin >> n; for(int i = 0;i < n;i++){ int u,v; cin >> u >> v; adj[u].push_back(v); adj[v].push_back(u); } bool cyc = true; for(int i =1;i <= n;i++){ if(adj[i].size() != 2){ cyc = false; break; } } if(cyc){ if(n % 4 == 0 || n % 4 == 3 && n > 3){ cout << n/2; }else{ cout << -1; } } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2652 KB | Output is correct |
2 | Correct | 1 ms | 2808 KB | Output is correct |
3 | Correct | 1 ms | 2652 KB | Output is correct |
4 | Correct | 1 ms | 2652 KB | Output is correct |
5 | Correct | 35 ms | 7004 KB | Output is correct |
6 | Incorrect | 24 ms | 7004 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2652 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2652 KB | Output is correct |
2 | Correct | 1 ms | 2808 KB | Output is correct |
3 | Correct | 1 ms | 2652 KB | Output is correct |
4 | Correct | 1 ms | 2652 KB | Output is correct |
5 | Correct | 35 ms | 7004 KB | Output is correct |
6 | Incorrect | 24 ms | 7004 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |