제출 #314481

#제출 시각아이디문제언어결과실행 시간메모리
314481jli12345Crocodile's Underground City (IOI11_crocodile)C++14
컴파일 에러
0 ms0 KiB
#include <iostream> #include <algorithm> #include <cmath> #include <vector> #include <functional> #include <cstdio> #include <array> #include <tuple> #include <unordered_map> #include <unordered_set> #include <queue> #include <set> #include <map> #include <list> #include <stack> #include <cstring> #include <string> #include <fstream> #include <sstream> #include <cstdlib> #include <iterator> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; typedef long long ll; typedef pair<int, int> pii; #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define ROF(i, b, a) for (int i = (b); i >= (a); --i) #define f first #define s second #define mp make_pair #define pb push_back const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3f; const ll MOD = 1e9+7; ll mod(ll x, ll mod){ return x >= mod ? x%mod:x; } void fio(string s){ freopen((s+".in").c_str(), "r", stdin); freopen((s+".out").c_str(), "w", stdout); } int N, M, K; vector <pii> arr[100100]; priority_queue<int> stor[100100]; int dist[100100]; struct comp{ bool operator()(const pii &a, const pii &b){ return a.s > b.s; } }; priority_queue<pii, vector<pii>, comp> pq; int main(){ scanf("%d%d%d", &N, &M, &K); FOR(i, 1, M){ int a, b, c; scanf("%d%d%d", &a, &b, &c); arr[a].pb(mp(b, c)); arr[b].pb(mp(a, c)); } memset(dist, INF, sizeof(dist)); FOR(i, 1, K){ int a; scanf("%d", &a); dist[a] = 0; pq.push(mp(a, 0)); } while (!pq.empty()){ int node = pq.top().f; int w = pq.top().s; pq.pop(); if (w > dist[node]) continue; FOR(i, 0, (int)arr[node].size()-1){ int nx = arr[node][i].f; int nw = arr[node][i].s; if ((int)stor[nx].size() < 2){ stor[nx].push(w+nw); } else if (stor[nx].top() > w+nw){ stor[nx].pop(); stor[nx].push(w+nw); } if ((int)stor[nx].size() >= 2 && dist[nx] > stor[nx].top()){ dist[nx] = stor[nx].top(); pq.push(mp(nx, dist[nx])); } } } printf("%d", stor[0].top()); }

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

crocodile.cpp: In function 'void fio(std::string)':
crocodile.cpp:44:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   44 |     freopen((s+".in").c_str(), "r", stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
crocodile.cpp:45:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   45 |     freopen((s+".out").c_str(), "w", stdout);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
crocodile.cpp: In function 'int main()':
crocodile.cpp:63:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   63 |     scanf("%d%d%d", &N, &M, &K);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
crocodile.cpp:66:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   66 |         scanf("%d%d%d", &a, &b, &c);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
crocodile.cpp:73:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   73 |         scanf("%d", &a);
      |         ~~~~~^~~~~~~~~~
/tmp/ccmCHhKZ.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/cc2lKWa2.o:crocodile.cpp:(.text.startup+0x0): first defined here
/tmp/ccmCHhKZ.o: In function `main':
grader.cpp:(.text.startup+0x2d): undefined reference to `travel_plan(int, int, int (*) [2], int*, int, int*)'
collect2: error: ld returned 1 exit status