Submission #553770

# Submission time Handle Problem Language Result Execution time Memory
553770 2022-04-26T22:15:11 Z MilosMilutinovic Meetings (JOI19_meetings) C++14
Compilation error
0 ms 0 KB
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
using namespace std;
 
#ifdef LOCAL
	#define eprintf(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);}
#else
	#define eprintf(...) 42
#endif
 
using ll = long long;
using ld = long double;
using uint = unsigned int;
using ull = unsigned long long;
template<typename T>
using pair2 = pair<T, T>;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
	return (ull)rng() % B;
}
 
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
 
clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

map<int, vector<int>> mapchik;

void Answer(int u, int v) {
	Bridge(min(u, v), max(u, v));
}

void solve(vector<int> v) {
	if (v.size() < 2) return;
	shuffle(all(v), rng);
	int x = v[0], y = v[1];
	vector<int> path(1, x);
	for (int i = 2; i < v.size(); i++) {
		int p = Query(x, y, v[i]);
		if (!mapchik.count(p))
			path.pb(p);
		mapchik[p].pb(v[i]);
	}
	sort(all(path), [&](int i, int j) {
		return Query(x, i, j) == i;
	});
	path.pb(y);
	for (int i = 1; i < path.size(); i++) 
		Answer(path[i], path[i - 1]);
	for (auto it : mapchik)
		solve(it.se);
}

void Solve(int n) {
	vector<int> vec(n);
	iota(all(vec), 0);
	solve(vec);
}

Compilation message

meetings.cpp: In function 'void Answer(int, int)':
meetings.cpp:57:2: error: 'Bridge' was not declared in this scope
   57 |  Bridge(min(u, v), max(u, v));
      |  ^~~~~~
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:65:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |  for (int i = 2; i < v.size(); i++) {
      |                  ~~^~~~~~~~~~
meetings.cpp:66:11: error: 'Query' was not declared in this scope
   66 |   int p = Query(x, y, v[i]);
      |           ^~~~~
meetings.cpp: In lambda function:
meetings.cpp:72:10: error: 'Query' was not declared in this scope
   72 |   return Query(x, i, j) == i;
      |          ^~~~~
meetings.cpp: In function 'void solve(std::vector<int>)':
meetings.cpp:75:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   75 |  for (int i = 1; i < path.size(); i++)
      |                  ~~^~~~~~~~~~~~~