Submission #869546

# Submission time Handle Problem Language Result Execution time Memory
869546 2023-11-04T17:00:44 Z JoksimKaktus Logičari (COCI21_logicari) C++17
0 / 110
20 ms 5724 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;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 20 ms 5724 KB Output is correct
6 Incorrect 20 ms 5724 KB Output isn't correct
7 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2648 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 1 ms 2648 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 20 ms 5724 KB Output is correct
6 Incorrect 20 ms 5724 KB Output isn't correct
7 Halted 0 ms 0 KB -