Submission #980929

#TimeUsernameProblemLanguageResultExecution timeMemory
980929vjudge1추월 (IOI23_overtaking)C++17
65 / 100
3514 ms26452 KiB
// hola soy Dember :D // 31/03/2024 #include <bits/stdc++.h> #include "overtaking.h" #define ll long long #define pll pair<ll,ll> //#define F first //#define S second #define Z size() #define pb push_back #define bp pop_back #define fo(x,y,z) for(ll x=y; x<=z; x++) #define of(x,y,z) for(ll x=y; x>=z; x--) #define all(n) n.begin(), n.end() #define arr(x,y,z) x+y, x+y+z using namespace std; const int MN=1e3+3; ll n, m, xd, zd, ans, l, r; ll a[MN], b[MN][MN], f[MN][MN], g[MN][MN], t[MN], w[MN], s[MN]; void init(int L, int N, vector<ll> T, vector<int> W, int X, int M, vector<int> S){ n=N; m=M; fo(i,0,n-1)a[i]=i, f[i][0]=t[i]=T[i], w[i]=W[i];w[n]=X; fo(i,0,m-1)s[i]=S[i]; fo(j,1,m-1){ sort(arr(a,0,n), [&] (const int &x, const int &y){ if(f[x][j-1]!=f[y][j-1])return f[x][j-1]<f[y][j-1]; return w[x]<w[y]; }); xd=0; fo(h,0,n-1){ ll i=a[h]; f[i][j]=max(xd, f[i][j-1]+w[i]*(s[j]-s[j-1])); xd=f[i][j]; } } fo(j,1,m-1){ sort(arr(a,0,n), [&] (const int &x, const int &y){ if(f[x][j-1]!=f[y][j-1])return f[x][j-1]<f[y][j-1]; return w[x]<w[y]; }); fo(h,0,n-1){ ll i=a[h]; g[j][h]=f[i][j]; if(h)g[j][h]=max(g[j][h], g[j][h-1]); } fo(i,0,n-1)b[i][j]=a[i]; } return; } ll arrival_time(long long Y) { ans=Y; fo(j,1,m-1){ l=0, r=n-1, zd=-1; while (l <= r) { xd=(l+r)/2; if (ans>f[b[xd][j]][j-1])zd=xd,l=xd+1; else r=xd-1; } xd=ans+w[n]*(s[j]-s[j-1]); if(zd!=-1)xd=max(xd, g[j][zd]); ans=xd; //cout<<ans<<" "; } return ans; }

Compilation message (stderr)

overtaking.cpp: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:14:19: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   14 | #define fo(x,y,z) for(ll x=y; x<=z; x++)
      |                   ^~~
overtaking.cpp:29:5: note: in expansion of macro 'fo'
   29 |     fo(i,0,n-1)a[i]=i, f[i][0]=t[i]=T[i], w[i]=W[i];w[n]=X;
      |     ^~
overtaking.cpp:29:53: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   29 |     fo(i,0,n-1)a[i]=i, f[i][0]=t[i]=T[i], w[i]=W[i];w[n]=X;
      |                                                     ^
#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...