제출 #551455

#제출 시각아이디문제언어결과실행 시간메모리
551455krit3379철로 (IOI14_rail)C++17
30 / 100
73 ms716 KiB
#include<bits/stdc++.h> using namespace std; #include"rail.h" #define N 5005 struct A{ int x,id; bool operator<(const A& o)const{ return x<o.x; } }; int dis[N][N]; A l,r; vector<A> v; set<int> L,R; void findLocation(int n, int first, int location[], int stype[]){ int i,pos; location[0]=first; stype[0]=1; if(n==1)return ; l={first,0}; L.insert(l.x); for(i=1;i<n;i++){ dis[0][i]=getDistance(0,i); v.push_back({dis[0][i],i}); } sort(v.begin(),v.end()); r={l.x+v[0].x,v[0].id}; location[v[0].id]=r.x; stype[v[0].id]=2; R.insert(r.x); for(i=1;i<v.size();i++){ int xl,xr; xl=getDistance(v[i].id,l.id); xr=getDistance(v[i].id,r.id); pos=l.x+xl; auto it1=L.lower_bound(pos); it1--; if(xr==r.x+pos-*it1*2){ A temp={pos,v[i].id}; location[v[i].id]=pos; stype[v[i].id]=2; r=max(r,temp); R.insert(pos); continue; } pos=r.x-xr; A temp={pos,v[i].id}; location[v[i].id]=pos; stype[v[i].id]=1; l=min(l,temp); L.insert(pos); } return ; }

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

rail.cpp: In function 'void findLocation(int, int, int*, int*)':
rail.cpp:34:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<A>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(i=1;i<v.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...