제출 #979570

#제출 시각아이디문제언어결과실행 시간메모리
979570vjudge1Swapping Cities (APIO20_swap)C++17
컴파일 에러
0 ms0 KiB
#include <time.h> #include <cstdlib> #include <stack> #include <numeric> #include <unordered_map> #include <unordered_set> #include <iomanip> #include <map> #include <set> #include <iterator> #include <deque> #include <queue> #include <sstream> #include <array> #include <string> #include <tuple> #include <chrono> #include <cassert> #include <cstdio> #include <cstring> #include <list> #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <bitset> using namespace std; int tt = 1, n, m; vector<pair<int, int>> g[200005]; pair<int, int> p[200005]; map<pair<int, int>, int> mp, pos; set<pair<int, int>> st; // int init() int getMinimumFuelCapacity(int X, int Y){ X++; Y++; if(n <= 3) return -1; int mx = 0; if(X != 1) mx = mp[{1, X}]; if(Y != 1) mx = max(mx, mp[{1, Y}]); if(X != 1) st.erase({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.erase({mp[{1, Y}], pos[{1, Y}]}); pair<int, int> p = *st.begin(); st.erase(st.begin()); if(X != 1 && Y != 1){ st.insert(p); if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]}); return max(mx, p.first); } else{ pair<int, int> p1 = *st.begin(); st.insert(p1); st.insert(p); if(X != 1) st.insert({mp[{1, X}], pos[{1, X}]}); if(Y != 1) st.insert({mp[{1, Y}], pos[{1, Y}]}); return max({mx, p.first, p1.first}); } } int main(){ ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); cin >> n >> m; for(int i = 1; i <= m; i++){ int a, b, c; cin >> a >> b >> c; a++; b++; g[a].push_back({b, c}); g[b].push_back({a, c}); mp[{a, b}] = c; mp[{b, a}] = c; pos[{a, b}] = i; pos[{b, a}] = i; st.insert({c, i}); } cin >> tt; while(tt--){ int x, y; cin >> x >> y; cout << getMinimumFuelCapacity(x, y) << "\n"; } }

컴파일 시 표준 에러 (stderr) 메시지

/usr/bin/ld: /tmp/cc9aDSGe.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccY37IRe.o:swap.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/cc9aDSGe.o: in function `main':
grader.cpp:(.text.startup+0x1c3): undefined reference to `init(int, int, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status