답안 #284890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
284890 2020-08-28T07:47:28 Z mohammad Simurgh (IOI17_simurgh) C++14
0 / 100
1 ms 384 KB
#include "simurgh.h"
#include<bits/stdc++.h>
using namespace std;
 
#define endl "\n"
// #define int long long

typedef long long ll ;
const ll ooo = 1e14 ;
const ll oo = 2e9 ;
const double PI = acos(-1) ;
const ll M = 1e9 + 7  ;
const int N = 10000010  ;

vector<pair<int , int>> g[501];
vector<int> r , ans;
int sz = 0 , vis[501];

void dfs(int u){
	cout << u << ' ' << r.size() << endl;
	vis[u] = 1;
	if(r.size() == sz - 1){
		int common = count_common_roads(r);
		cout << common << endl;
		if(common == sz - 1) ans = r;
		return;
	}
	for(auto v : g[u]){
		if(ans.size()) return;
		if(!vis[v.first]){
			r.push_back(v.second);
			dfs(v.first);
			r.erase(r.begin() + r.size() - 1);
		}
	}
	vis[u]= 0 ;
}

vector<int> find_roads(int n, vector<int> u, vector<int> v) {
	sz = n;
	int m = u.size();
	for(int i = 0 ; i < m ; ++i){
		g[u[i]].push_back({v[i] , i});
		g[v[i]].push_back({u[i] , i});
		r = vector<int>(n - 1 , i);
		if(count_common_roads(r) == n - 1) return r;
	}
	// dfs(0);
	// for(auto x : ans) cout << x << ' '; cout << endl;
	// for(int i = 0 ; i < n - 1 ; ++i) ans.push_back(0);
	return ans;
}

Compilation message

simurgh.cpp: In function 'void dfs(int)':
simurgh.cpp:22:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   22 |  if(r.size() == sz - 1){
      |     ~~~~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB WA in grader: NO
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB correct
2 Incorrect 0 ms 384 KB WA in grader: NO
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB WA in grader: NO
2 Halted 0 ms 0 KB -