제출 #881225

#제출 시각아이디문제언어결과실행 시간메모리
881225cpptowinJakarta Skyscrapers (APIO15_skyscraper)C++17
0 / 100
13 ms27308 KiB
#include<bits/stdc++.h> #define fo(i,d,c) for(int i=d;i<=c;i++) #define fod(i,c,d) for(int i=c;i>=d;i--) #define maxn 1000010 #define N 1010 #define fi first #define se second #define pb emplace_back #define en cout<<"\n"; #define int long long #define inf 1000000000 #define pii pair<int,int> #define vii vector<pii> #define lb(x) x&-x #define bit(i,j) ((i>>j)&1) #define offbit(i,j) (i^(1<<j)) #define onbit(i,j) (i|(1<<j)) #define vi vector<int> template <typename T1, typename T2> bool minimize(T1 &a, T2 b){if (a > b) {a = b; return true;} return false;} template <typename T1, typename T2> bool maximize(T1 &a, T2 b){if (a < b) {a = b; return true;} return false;} using namespace std; int n,m; pii a[maxn]; int d[maxn]; vii ke[maxn]; void dij(int inp) { fo(i,1,m) d[i] = inf; d[inp] = 0; priority_queue<pii,vii,greater<pii>> q; q.push({0,inp}); while(q.size()) { auto [du,u] = q.top(); q.pop(); if(du != d[u]) continue; for(auto [v,w] : ke[u]) { if(d[v] > d[u] + w) { d[v] = d[u] + w; q.push({d[v],v}); } } } } main() { #define name "TASK" if(fopen(name".inp","r")) { freopen(name".inp","r",stdin); freopen(name".out","w",stdout); } ios_base::sync_with_stdio(false);cin.tie(NULL); cin >> n >> m; fo(i,1,m) cin >> a[i].fi >> a[i].se; fo(i,1,m) fo(j,1,m) if(i != j) { int val = abs(a[i].fi - a[j].fi); if(val % a[i].se == 0) ke[i].pb(j,val / a[i].se); } dij(1); cout << d[2]; }

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

skyscraper.cpp:47:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   47 | main()
      | ^~~~
skyscraper.cpp: In function 'int main()':
skyscraper.cpp:52:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |        freopen(name".inp","r",stdin);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
skyscraper.cpp:53:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |        freopen(name".out","w",stdout);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...