답안 #613735

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
613735 2022-07-30T09:58:19 Z Mr_Husanboy Simurgh (IOI17_simurgh) C++14
0 / 100
6 ms 340 KB
#include "simurgh.h"
#include<bits/stdc++.h>

using namespace std;
#define all(a) (a).begin(), (a).end()
#define vi vector<int>
#define ff first
#define ss second


vector<pair<int,int>> g[500];

vector<int> find_roads(int n, vector<int> u, vector<int> v) {
	vector<int> p;
	for(int i=0; i<u.size(); i++){
        g[u[i]].push_back({v[i],i});
        g[v[i]].emplace_back(u[i],i);
	}
	for(int i=0; i<n; i++) p.push_back(i);
	do{
        bool ok = 1;
        vector<int> tem;
        for(int i=1; i<n && ok; i++){
            bool found = 0;
            for(auto u : g[p[i]]){
                if(u.ff == p[i-1]){
                    found = 1;
                    tem.push_back(u.ss);
                }

            }ok &= found;
        }
        //for(auto u:tem) cout << u << ' '; cout << ok<<"tem" << endl;
        if(ok){

            if(count_common_roads(tem) == n-1) return tem;
        }
	}while(next_permutation(all(p)));
}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:15:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i=0; i<u.size(); i++){
      |               ~^~~~~~~~~
simurgh.cpp:14:14: warning: control reaches end of non-void function [-Wreturn-type]
   14 |  vector<int> p;
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB correct
2 Incorrect 6 ms 308 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -