# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143510 | kig9981 | 버스 (JOI14_bus) | C++17 | 514 ms | 35832 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#ifdef NON_SUBMIT
#define TEST(n) (n)
#define tout cerr
#else
#define TEST(n) ((void)0)
#define tout cin
#endif
using namespace std;
vector<tuple<int,int,int>> adj[100000];
vector<int> D[100000], x[100000];
int solve(int c, int t)
{
if(c==0) return x[c][t];
if(D[c][t]!=0x7fffffff) return D[c][t];
if(t) D[c][t]=solve(c,t-1);
else D[c][t]=-1;
for(int i=lower_bound(adj[c].begin(),adj[c].end(),make_tuple(x[c][t],-1,-1))-adj[c].begin();i<adj[c].size() && get<0>(adj[c][i])==x[c][t];i++) {
int tmp, n, v;
tie(tmp,n,v)=adj[c][i];
v=lower_bound(x[n].begin(),x[n].end(),v)-x[n].begin();
D[c][t]=max(D[c][t],solve(n,v));
}
return D[c][t];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |