답안 #1045385

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1045385 2024-08-05T22:35:36 Z beaconmc Simurgh (IOI17_simurgh) C++14
0 / 100
58 ms 4144 KB
#include "simurgh.h"

#include <bits/stdc++.h>

 
typedef int ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)
#define FORNEG(i,x,y) for(ll i=x; i>y; i--)
 
using namespace std;

bool visited[1000];
vector<array<ll,2>> edges[1000];

ll N;

vector<ll> ans;

void dfs(ll a, ll p){
	for (auto&i : edges[a]){
		if (i[0] != p && visited[i[0]] == 0){
			visited[i[0]] = 1;
			ans.push_back(i[1]);
			dfs(i[0], p);
		}
	}
}



vector<int> find_roads(int n, vector<int> u, vector<int> v) {
	

	FOR(i,0,u.size()){
		edges[u[i]].push_back({v[i],i});
		edges[v[i]].push_back({u[i],i});
	}
	set<ll> realans;

	FOR(i,0,n){
		FOR(p,0,1000) visited[p] = 0;
		ans.clear();

		if (i==0) visited[1]=1,dfs(1,i);
		else visited[0]=1,dfs(0,i);

		if (ans.size() == n-2){

			vector<array<ll,2>> idk;
			for (auto&j : edges[i]){
				ans.push_back(j[1]);
				ll sus = count_common_roads(ans);

				
				idk.push_back({sus, j[1]});
				ans.pop_back();
			}
			sort(idk.begin(), idk.end());

			for (auto&i : idk) if (i[0] == idk[idk.size()-1][0]) realans.insert(i[1]);
		}
	}
	vector<ll> temp;
	for (auto&i : realans) temp.push_back(i);


	return temp;



}

Compilation message

simurgh.cpp: In function 'std::vector<int> find_roads(int, std::vector<int>, std::vector<int>)':
simurgh.cpp:7:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 | #define FOR(i,x,y) for(ll i=x; i<y; i++)
......
   34 |  FOR(i,0,u.size()){
      |      ~~~~~~~~~~~~                
simurgh.cpp:34:2: note: in expansion of macro 'FOR'
   34 |  FOR(i,0,u.size()){
      |  ^~~
simurgh.cpp:47:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   47 |   if (ans.size() == n-2){
      |       ~~~~~~~~~~~^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB correct
2 Correct 0 ms 348 KB correct
3 Correct 0 ms 348 KB correct
4 Correct 0 ms 348 KB correct
5 Correct 0 ms 348 KB correct
6 Correct 0 ms 348 KB correct
7 Correct 0 ms 348 KB correct
8 Correct 0 ms 348 KB correct
9 Correct 0 ms 456 KB correct
10 Correct 0 ms 344 KB correct
11 Incorrect 0 ms 348 KB WA in grader: NO
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB correct
2 Correct 0 ms 348 KB correct
3 Correct 0 ms 348 KB correct
4 Correct 0 ms 348 KB correct
5 Correct 0 ms 348 KB correct
6 Correct 0 ms 348 KB correct
7 Correct 0 ms 348 KB correct
8 Correct 0 ms 348 KB correct
9 Correct 0 ms 456 KB correct
10 Correct 0 ms 344 KB correct
11 Incorrect 0 ms 348 KB WA in grader: NO
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB correct
2 Correct 0 ms 348 KB correct
3 Correct 0 ms 348 KB correct
4 Correct 0 ms 348 KB correct
5 Correct 0 ms 348 KB correct
6 Correct 0 ms 348 KB correct
7 Correct 0 ms 348 KB correct
8 Correct 0 ms 348 KB correct
9 Correct 0 ms 456 KB correct
10 Correct 0 ms 344 KB correct
11 Incorrect 0 ms 348 KB WA in grader: NO
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB correct
2 Correct 0 ms 348 KB correct
3 Incorrect 58 ms 4144 KB WA in grader: NO
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB correct
2 Correct 0 ms 348 KB correct
3 Correct 0 ms 348 KB correct
4 Correct 0 ms 348 KB correct
5 Correct 0 ms 348 KB correct
6 Correct 0 ms 348 KB correct
7 Correct 0 ms 348 KB correct
8 Correct 0 ms 348 KB correct
9 Correct 0 ms 456 KB correct
10 Correct 0 ms 344 KB correct
11 Incorrect 0 ms 348 KB WA in grader: NO
12 Halted 0 ms 0 KB -