제출 #129059

#제출 시각아이디문제언어결과실행 시간메모리
129059nxteru철로 (IOI14_rail)C++14
30 / 100
85 ms760 KiB
#include "rail.h" #include <bits/stdc++.h> using namespace std; typedef pair<int,int> P; #define F first #define S second #define PB push_back int mac,mad,mic,mid; vector<P>p; int h[5005]; void findLocation(int n, int f, int l[], int t[]){ l[0]=f,t[0]=1; for(int i=1;i<n;i++)p.PB(P(getDistance(0,i),i)); sort(p.begin(),p.end()); mad=p[0].S,mid=p[0].S; l[p[0].S]=f+p[0].F; h[p[0].S]=p[0].F; t[p[0].S]=2; for(int i=1;i<p.size();i++){ int d=p[i].F,x=p[i].S; h[x]=d; int a=getDistance(mic,x),b=getDistance(mad,x); if(h[mic]>a&&h[mad]<b){ if(a-b==2*l[mid]-l[mic]-l[mad])l[x]=l[mad]-b,t[x]=1; else l[x]=a+l[mic],t[x]=2; }else if(h[mic]<a&&h[mad]>b){ if(a-b==2*l[mac]-l[mic]-l[mad])l[x]=a+l[mic],t[x]=2; else l[x]=l[mad]-b,t[x]=1; }else{ if(a-b==2*l[mid]-l[mic]-l[mad])l[x]=l[mad]-b,t[x]=1; else l[x]=a+l[mic],t[x]=2; } if(t[x]==1){ if(l[mic]>l[x])mic=x; if(l[mac]<l[x])mac=x; }else{ if(l[mid]>l[x])mid=x; if(l[mad]<l[x])mad=x; } } }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:19:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<p.size();i++){
              ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...