답안 #228027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
228027 2020-04-29T15:10:44 Z AaronNaidu Simurgh (IOI17_simurgh) C++14
0 / 100
6 ms 384 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++)
                       ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB correct
2 Incorrect 5 ms 384 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 256 KB WA in grader: NO
2 Halted 0 ms 0 KB -