답안 #892855

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892855 2023-12-26T05:41:24 Z shoryu386 Trampoline (info1cup20_trampoline) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

#define int long long

#define MAXN 400007
vector<int> adj[MAXN];
bitset<MAXN> bs[MAXN];
bool vis[MAXN];

void dfs(int u) {
	for(int v: adj[u]) {
		if(!vis[v]) {
			vis[v] = 1;
			dfs(v);
		} 
		bs[u] |= bs[v];
	}
}


main(){
	int r, c, n; cin >> r >> c >> n;
	
	//r and c are useless lmao
	int N = 0;
	map<int, set< pair<int, bool> >> importantPts; int a, b;
	for (int x = 0; x < n; x++){
		cin >> a >> b;
		importantPts[a].insert({b, 1}); //1 indicating green trampoline
		N++;
	}
	
	int q; cin >> q;
	pair<int, int> starts[q], ends[q]; 
	for (int x = 0; x < q; x++){
		cin >> starts[x].first >> starts[x].second >> ends[x].first >> ends[x].second;
		
		importantPts[ends[x].first].insert({ends[x].second, 0});
		N++;
	}

	map<pair<int, int>, int> coordToNode;
	pair<int, int> hmm[N];
	
	int cnt = 0;
	for (auto y : importantPts){
		for (auto z : y.second){
			coordToNode[{y.first, z.first}] = cnt;
			hmm[cnt] = {y.first, z.first};
			cnt++;
		}
	}
	
	for (auto y : importantPts){ //gen DAG
	
		pair<int, int> lastCoords = {-1, -1};
	
		for (auto z : y.second){
			if (lastCoords.first != -1) adj[coordToNode[lastCoords]].push_back(coordToNode[{y.first, z.first}]);
			
			auto lb = importantPts[y.first+1].lower_bound({z.first, 0});
			if (lb != importantPts[y.first+1].end()){
				adj[coordToNode[{y.first, z.first}]].push_back(coordToNode[{y.first+1, lb->first}]);
			}
			lastCoords = {y.first, z.first};
		}
	}
	
	for (int i = 0; i < N; i++) bs[i][i] = 1;
	for (int i = 0; i < N; i++) {
		if (vis[i]) continue;
		vis[i] = 1;
		dfs(i);
	}
	
	for (int x = 0; x < q; x++){
		auto startTramp = importantPts[starts[x].first].lower_bound({starts[x].second, 0});
		
		if (startTramp == importantPts[starts[x].first].end()){
			cout << "No\n"; continue;
		}
		
		int startF = starts[x].first, startS = startTramp->first;
		if (bs[coordToNode[{startF, startS}]][coordToNode[{ends[x].first, ends[x].second}]]){
			cout << "Yes\n";
		}
		else cout << "No\n";
	}
	
	
	
}

Compilation message

trampoline.cpp:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){
      | ^~~~
/tmp/cc9Nqs8F.o: in function `__tcf_0':
trampoline.cpp:(.text+0x9): relocation truncated to fit: R_X86_64_PC32 against symbol `adj' defined in .bss section in /tmp/cc9Nqs8F.o
/tmp/cc9Nqs8F.o: in function `dfs(long long)':
trampoline.cpp:(.text+0x46d): relocation truncated to fit: R_X86_64_PC32 against symbol `adj' defined in .bss section in /tmp/cc9Nqs8F.o
/tmp/cc9Nqs8F.o: in function `main':
trampoline.cpp:(.text.startup+0x8): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
trampoline.cpp:(.text.startup+0xbe): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
trampoline.cpp:(.text.startup+0x17f): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
trampoline.cpp:(.text.startup+0x2ae): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cin' defined in .bss._ZSt3cin section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
trampoline.cpp:(.text.startup+0x886): relocation truncated to fit: R_X86_64_PC32 against symbol `adj' defined in .bss section in /tmp/cc9Nqs8F.o
trampoline.cpp:(.text.startup+0x9de): relocation truncated to fit: R_X86_64_PC32 against symbol `adj' defined in .bss section in /tmp/cc9Nqs8F.o
trampoline.cpp:(.text.startup+0xef5): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
trampoline.cpp:(.text.startup+0xf98): relocation truncated to fit: R_X86_64_PC32 against symbol `std::cout' defined in .bss._ZSt4cout section in /usr/lib/gcc/x86_64-linux-gnu/10/libstdc++.a(globals_io.o)
/tmp/cc9Nqs8F.o: in function `_GLOBAL__sub_I_adj':
trampoline.cpp:(.text.startup+0x11eb): additional relocation overflows omitted from the output
/usr/bin/ld: failed to convert GOTPCREL relocation; relink with --no-relax
collect2: error: ld returned 1 exit status