제출 #848660

#제출 시각아이디문제언어결과실행 시간메모리
848660Lib추월 (IOI23_overtaking)C++17
19 / 100
6 ms9304 KiB
#include "overtaking.h" #include <bits/stdc++.h> using namespace std; long long rspeed[1003]; long long spos[1003]; long long stime[1003]; long long arrtime[1003][1003]; //thoi gian xe k den ben i vector <long long> temp; pair<long long, int> sarrtime[1003][1003]; vector <pair<long long, int> > previ; long long ok[1003]; long long atime[1003]; long long L,N,M,X,Y; void init(int LL, int NN, vector<long long> T, vector<int> W, int XX, int MM, vector<int> S) { L = LL; N = NN; M = MM; X = XX; long long len=L,spd=X; int n=N,m=M; long long cmax; for(int i=1;i<=n;i++){ stime[i]=T[i-1]; arrtime[1][i]=stime[i]; sarrtime[1][i]={stime[i],i}; previ.push_back({stime[i],i}); } for(int i=1;i<=n;i++){ rspeed[i]=W[i-1]; } for(int i=1;i<=m;i++){ spos[i]=S[i-1]; } for(int i=2;i<=m;i++){ previ.push_back({0,0}); sort(previ.begin(),previ.end()); arrtime[i][previ[1].second]=arrtime[i-1][previ[1].second]+(spos[i]-spos[i-1])*rspeed[previ[1].second]; cmax=arrtime[i][previ[1].second]; for(int k=2;k<=n;k++){ cmax=max(cmax,previ[k].first+(spos[i]-spos[i-1])*rspeed[previ[k].second]); arrtime[i][previ[k].second]=cmax; sarrtime[i][previ[k].second]={arrtime[i][previ[k].second],previ[k].second}; } previ.clear(); for(int k=1;k<=n;k++){ previ.push_back({arrtime[i][k],k}); } } previ.clear(); } long long arrival_time(long long Y){ for(int i=1;i<=1000;i++){ ok[i]=1; atime[i]=0; } for(int i=1;i<=N;i++){ if(arrtime[1][i]>=Y){ ok[i]=0; }else{ ok[i]=1; } } atime[1]=Y; for(int i=2;i<=M;i++){ atime[i]=atime[i-1]+(spos[i]-spos[i-1])*X; for(int k=1;k<=N;k++){ if(atime[i-1]<=arrtime[i-1][k]){ ok[k]=0; } if(ok[k]==1){ atime[i]=max(atime[i],arrtime[i][k]); } } } long long ans=atime[M]; return ans; }

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

overtaking.cpp: In function 'void init(int, int, std::vector<long long int>, std::vector<int>, int, int, std::vector<int>)':
overtaking.cpp:20:15: warning: unused variable 'len' [-Wunused-variable]
   20 |     long long len=L,spd=X;
      |               ^~~
overtaking.cpp:20:21: warning: unused variable 'spd' [-Wunused-variable]
   20 |     long long len=L,spd=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...