# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
16293 |
2015-08-20T01:23:07 Z |
eaststar |
버스 (JOI14_bus) |
C++14 |
|
234 ms |
7728 KB |
#include <stdio.h>
#include <algorithm>
using namespace std;
struct data{
int a,b,x,y;
bool operator<(const data&r)const{
if(a==r.a)return x>r.x;
return a<r.a;
}
}a[300010];
struct ans{
int s,e;
bool operator<(const ans&r)const{
return e>r.e;
}
}b[100010];
int st[100010],s[100010],e[100010],cnt,n,m;
int f(int p,int t){
int i,m=1e8;
if(p==n)return t;
for(i=st[p];a[i].a==p&&a[i].x>=t;++i)m=min(m,f(a[i].b,a[i].y));
return m;
}
int main(){
int i,q,t;
scanf("%d%d",&n,&m);
for(i=1;i<=m;++i)scanf("%d%d%d%d",&a[i].a,&a[i].b,&a[i].x,&a[i].y);
sort(a+1,a+m+1);
for(i=1;i<=m;++i)if(a[i].a!=a[i-1].a)st[a[i].a]=i;
a[0].x=-1;
for(i=1;a[i].a==1;++i)if(a[i].x!=a[i-1].x)b[cnt].s=a[i].x,b[cnt++].e=f(1,a[i].x);
sort(b,b+cnt);
for(i=0;i<cnt;++i)s[i]=b[i].s,e[i]=b[i].e;
scanf("%d",&q);
for(;q--;){
scanf("%d",&t);
i=lower_bound(e,e+cnt,t)-e;
printf("%d\n",i==cnt?-1:s[i]);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
7728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
7728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
186 ms |
7728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
234 ms |
7728 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |