답안 #1052082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1052082 2024-08-10T11:44:31 Z fuad27 Spy 3 (JOI24_spy3) C++17
컴파일 오류
0 ms 0 KB
#include "Aoi.h"
#include <bits/stdc++.h>
using namespace std;
std::string aoi(int N, int M, int Q, int K, std::vector<int> A,
                std::vector<int> B, std::vector<long long> C,
                std::vector<int> T, std::vector<int> X) {
	vector<vector<int>> g(N);
	for(int i = 0;i<M;i++) {
		g[A[i]].push_back(i);
		g[B[i]].push_back(i);
	}
	vector<long long> dist(N, (long long)1e18);
	vector<int> pr(N, -1);
	dist[0] = 0;
	priority_queue<pair<long long, int>> pq;
	pq.push({0, 0});
	vector<int> bad_edge(M);
	for(auto i=0;i<X.size();i++)bad_edge[X[i]]=i+1;
	vector<bool> vis(N);
	while(pq.size()) {
		int at = pq.top().second;
		pq.pop();
		if(vis[at])continue;
		vis[at]=1;
		for(int idx:g[at]) {
			int to = (at^A[idx]^B[idx]);
			long long w = C[idx];
			if(dist[to] > dist[at] + w) {
				dist[to] = dist[at] + w;
				pr[to] = idx;
				pq.push(pair<long long, int>(-dist[to], to));
			}
		}
	}
	vector<int> par_final(K+Q);
	for(int iii = 0;iii<Q;iii++) {
		int cur = pr[T[iii]];
		int prev = iii+K;
		bool fl=0;
		while(1) {
			if(cur == -1 or bad_edge[cur]) {
				if(cur != -1) {
					par_final[prev] = bad_edge[cur]-1;
				}
				else {
					par_final[prev] = -1;
				}
				prev = bad_edge[cur]-1;
			}
			if(cur == -1)break;
			if(dist[A[cur]] < dist[B[cur]]) {
				cur = pr[A[cur]];		
			}
			else cur = pr[B[cur]];
		}
	}
	string res = "";
	for(int i = 0;i<Q+K;i++) {
//		cout << i << " " << par_final[i] << endl;
		par_final[i]++;
		for(int j = 0;j<9;j++) {
			if(par_final[i]&(1<<j))res+="1";
			else res+="0";
		}
	}
//	cout << res.size() << endl;
	return res;
}
#include "biscuits.h"
#include <bits/stdc++.h>
using namespace std;
map<pair<int, long long>, long long> mp;
long long X;
vector<long long> A;
int k;
long long solve(int i, long long add) {
	if(i == k)return 1;
	if(mp.find({i, add}) != mp.end())return mp[{i, add}];
	mp[{i, add}] += solve(i+1, (add+A[i])/2);
	if(add+A[i] >= X) {
		mp[{i, add}] += solve(i+1, (add+A[i]-X)/2);
	}
	return mp[{i, add}];
}
long long count_tastiness(long long x, std::vector<long long> a) {
	mp.clear();
	X=x;
	A=a;
	k = 60;
	A.resize(61);
	for(int i = 0;i<k;i++) {
		if(A[i] > x) {
			long long c = A[i]-x;
			A[i+1] += c/2;
			c/=2;
			c*=2;
			A[i] -= c;
		}
	}
	return solve(0, 0);
}
 

Compilation message

Aoi.cpp: In function 'std::string aoi(int, int, int, int, std::vector<int>, std::vector<int>, std::vector<long long int>, std::vector<int>, std::vector<int>)':
Aoi.cpp:18:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |  for(auto i=0;i<X.size();i++)bad_edge[X[i]]=i+1;
      |               ~^~~~~~~~~
Aoi.cpp:39:8: warning: unused variable 'fl' [-Wunused-variable]
   39 |   bool fl=0;
      |        ^~

Bitaro.cpp:1:10: fatal error: biscuits.h: No such file or directory
    1 | #include "biscuits.h"
      |          ^~~~~~~~~~~~
compilation terminated.