답안 #670988

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
670988 2022-12-11T15:29:08 Z US3RN4M3 Amusement Park (JOI17_amusement_park) C++17
컴파일 오류
0 ms 0 KB
#include "Joi.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void Joi(int N, int M, int A[], int B[], long long X, int T) {
	vector<vector<int>> graph(N);
	vector<pair<int, int>> edges(M);
	for(int i = 0; i < M; i++) edges[i] = {min(A[i], B[i]), max(A[i], B[i])};
	sort(edges.begin(), edges.end());
	for(auto & [x, y] : edges) {
		graph[x].push_back(y);
		graph[y].push_back(x);
	}

	int counter = 0;

	vector<bool> vis(N, false);
	vector<int> bit(N, 0);
	vector<int> euler_path;

	function<void(int)> dfs = [&](int cur) {
		vis[cur] = true;
		euler_path.push_back(cur);
		for(int nxt : graph[cur]) if(!vis[nxt]) {
			dfs(nxt);
			euler_path.push_back(cur);
		}
	};

	dfs(0);

	vis = vector<bool>(N, false);

	for(int & i : euler_path) {
		if(vis[i]) continue;
		vis[i] = true;
		bit[i] = (counter++) % 60;
		MessageBoard(i, (X >> (ll)bit[i]) & 1);
	}
}
#include "Ioi.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
long long Ioi(int N, int M, int A[], int B[], int P, int V, int T) {
	vector<vector<int>> graph(N);
	vector<pair<int, int>> edges(M);
	for(int i = 0; i < M; i++) edges[i] = {min(A[i], B[i]), max(A[i], B[i])};
	sort(edges.begin(), edges.end());
	for(auto & [x, y] : edges) {
		graph[x].push_back(y);
		graph[y].push_back(x);
	}

	int counter = 0;

	vector<bool> vis(N, false);
	vector<int> bit(N, 0);
	vector<int> euler_path;

	function<void(int)> dfs = [&](int cur) {
		vis[cur] = true;
		euler_path.push_back(cur);
		for(int nxt : graph[cur]) if(!vis[nxt]) {
			dfs(nxt);
			euler_path.push_back(cur);
		}
	};

	dfs(0);

	vis = vector<bool>(N, false);

	for(int & i : euler_path) {
		if(vis[i]) {
			continue;
		}
		vis[i] = true;
		bit[i] = (counter++) % 60;
	}

	set<pair<int, int>> edges2;
	for(auto [x, y] : edges) edges2.insert({x, y});

	int path_len = euler_path.size();
	for(int i = 1; i < path_len; i++) euler_path.push_back(euler_path[i]);
	for(int i = 1; i < path_len; i++) euler_path.push_back(euler_path[i]);

	int start_pos = 0;
	while(euler_path[start_pos] != P) start_pos++;
	ll ans = (ll)V << bit[P];
	for(int i = start_pos + 1; i <= start_pos + 120; i++) {
		if(edges2.find({euler_path[i - 1], euler_path[i]} == edges2.end()) return ans;
		ans |= (ll)Move(euler_path[i]) << bit[euler_path[i]];
	}
	return ans;
}

Compilation message

Ioi.cpp: In function 'long long int Ioi(int, int, int*, int*, int, int, int)':
Ioi.cpp:53:52: error: expected ')' before '==' token
   53 |   if(edges2.find({euler_path[i - 1], euler_path[i]} == edges2.end()) return ans;
      |                 ~                                  ^~~
      |                                                    )
Ioi.cpp:53:69: error: expected ';' before 'return'
   53 |   if(edges2.find({euler_path[i - 1], euler_path[i]} == edges2.end()) return ans;
      |                                                                     ^~~~~~~
      |                                                                     ;
Ioi.cpp:54:55: error: expected ')' before ';' token
   54 |   ans |= (ll)Move(euler_path[i]) << bit[euler_path[i]];
      |                                                       ^
      |                                                       )
Ioi.cpp:53:5: note: to match this '('
   53 |   if(edges2.find({euler_path[i - 1], euler_path[i]} == edges2.end()) return ans;
      |     ^