Submission #228032

# Submission time Handle Problem Language Result Execution time Memory
228032 2020-04-29T15:22:41 Z AaronNaidu Simurgh (IOI17_simurgh) C++14
0 / 100
5 ms 256 KB
#include <bits/stdc++.h>
#include "simurgh.h"
using namespace std;

int n;
vector<int> u, v;

vector<int> subset, toRet;
bool visited[600];

void getSubset(int used, int pos) {
    if (used == n-1)
    {
        for (int i = 0; i < n-1; i++)
        {
            visited[u[subset[i]]] = true;
            visited[v[subset[i]]] = true;
        }
        bool allRight = true;
        for (int i = 0; i < n; i++)
        {
            if (!visited[i])
            {
                allRight = false;
            }
        }
        if (allRight)
        {
            if (count_common_roads(subset) == n-1)
            {
                toRet = subset;
            }
        }
        for (int i = 0; i < n; i++)
        {
            visited[i] = false;
        }
        
        return;
    }

    if (pos >= u.size())
    {
        return;
    }
    
    for (int i = pos; i < u.size(); i++)
    {
        subset.push_back(i);
        getSubset(used+1, i+1);
        subset.pop_back();
    }
    
}

vector<int> find_roads(int ln, vector<int> lu, vector<int> lv) {
    n = ln;
    u = lu;
    v = lv;
    getSubset(0, 0);
    return toRet;
}

Compilation message

simurgh.cpp: In function 'void getSubset(int, int)':
simurgh.cpp:42:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (pos >= u.size())
         ~~~~^~~~~~~~~~~
simurgh.cpp:47:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = pos; i < u.size(); i++)
                       ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB correct
2 Incorrect 4 ms 256 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -