Submission #1065704

#TimeUsernameProblemLanguageResultExecution timeMemory
1065704UnforgettableplLong Distance Coach (JOI17_coach)C++17
71 / 100
2068 ms18600 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int32_t main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int X,N,M,W,T; cin >> X >> N >> M >> W >> T; vector<tuple<int,int,int>> arr; arr.emplace_back(0,0,0); int iterations = X/T; X%=T; arr.emplace_back(X,2,iterations); for(int i=1;i<=N;i++) { int S;cin>>S; arr.emplace_back(S%T,2,S/T); } for(int i=1;i<=M;i++) { int D,C;cin>>D>>C; arr.emplace_back(D,1,C); } sort(arr.begin(), arr.end()); vector<int> DP(arr.size()); DP[0] = (iterations+1)*W; for(int i=1;i<arr.size();i++) { auto [pos,type,c] = arr[i]; if(type==1) { if(pos<X)DP[i]=(iterations+1)*W + DP[i-1]; else DP[i]=iterations*W + DP[i-1]; continue; } DP[i]=DP[i-1]; int mini = c; int offset = 0; for(int j=i-1;j;j--) { if(get<1>(arr[j])!=1) { mini = min(mini,get<2>(arr[j])); if(mini<c)break; continue; } offset+=get<2>(arr[j])+mini*W; DP[i]=min(DP[i],DP[j-1]+offset); } } cout << DP.back() << '\n'; }

Compilation message (stderr)

coach.cpp: In function 'int32_t main()':
coach.cpp:28:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::tuple<long long int, long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |     for(int i=1;i<arr.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...