제출 #727191

#제출 시각아이디문제언어결과실행 시간메모리
727191WKYH밀림 점프 (APIO21_jumps)C++14
4 / 100
861 ms2632 KiB
#include<bits/stdc++.h> #define qc ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define rt return #define fi first #define se second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define vecin(a) for(auto &d:a)cin>>d; typedef long long int ll; const long long mod=1e9+7; const int int_inf=2147483647; const long long int ll_inf=9223372036854775807; const int alp_up=64; const int alp_lw=96; int dx[]={-1,-1,0,1,1,1,0,-1}; int dy[]={0,1,1,1,0,-1,-1,-1}; using namespace std; ll gcd(ll a,ll b){if(b==0)rt a;rt gcd(b,a%b);} ll lcm(ll a,ll b){rt a/gcd(a,b)*b;} void setIO(string name) { ios_base::sync_with_stdio(0); cin.tie(0); freopen((name+".in").c_str(),"r",stdin); freopen((name+".out").c_str(),"w",stdout); } //* vector<int>w; void init(int n,vector<int>h) { w.resize(n); } int minimum_jumps(int a,int b,int c,int d) { rt c-b; } int _main() { rt 0; } /*/ int n,k; vector<pair<ll,int>>age; vector<vector<pair<int,ll>>>edge; vector<ll>ans; //vector<bool>vis; bool comp(pair<ll,int>a,pair<ll,int>b){rt a.se<b.se;} int main() { cin>>n>>k; age.resize(n); edge.resize(n); //vis.resize(n,0); ans.resize(n,ll_inf); for(int i=0;i<n;i++){ cin>>age[i].first; age[i].second=i; } for(int i=0;i<k;i++){ int u,v;cin>>u>>v; u--;v--; edge[u].push_back({v,0}); edge[v].push_back({u,0}); } sort(all(age)); for(int i=0;i<n-1;i++){ edge[age[i].second].push_back({age[i+1].second,abs(age[i].first-age[i+1].first)}); edge[age[i+1].second].push_back({age[i].second,abs(age[i].first-age[i+1].first)}); } ans[0]=0; priority_queue<pair<ll,int>>q; q.push({-ans[0],0}); while(!q.empty()){ int u=-q.top().first,v=q.top().second; q.pop(); //if(vis[v])continue; //vis[v]=1; for(auto c:edge[v]){ if(ans[c.fi]>ans[v]+c.se){ ans[c.fi]=ans[v]+c.se; q.push({-ans[c.fi],c.fi}); } } } for(auto c:ans)cout<<c<<" "; } //*/

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

jumps.cpp: In function 'void setIO(std::string)':
jumps.cpp:24:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |     freopen((name+".in").c_str(),"r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jumps.cpp:25:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |     freopen((name+".out").c_str(),"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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...