Submission #857367

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8573672023-10-06 03:44:20restingOvertaking (IOI23_overtaking)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
vector<pair<int, int>> restriction; // if "starts after a", has to "end after b" yk
int x, l;
bool comp(const pair<int,int>&a, const pair<int,int>&b){
if(a.second == b.second) return a.first > b.first;
return a.second < b.second;
}
void init(int32_t L, int32_t N, std::vector<long long> T, std::vector<int32_t> W, int32_t X, int32_t M, std::vector<int32_t> S)
{
x = X; l = L;
vector<vector<pair<int, int>>> restrictions(M);// yes
vector<pair<int, int>> cur;
for (int i = 0; i < N; i++) if (W[i] > X) cur.push_back({ T[i], W[i] - X });
for (int i = 0; i < M-1; i++) {
sort(cur.begin(), cur.end());
vector<pair<int, int>> res;
const int T = cur.size();
for (int j = 0; j < T; j++) res.push_back({ cur[j].first + cur[j].second * (S[i + 1] - S[i]), cur[j].second });
for (int j = 0; j < T - 1; j++) if (res[j].first > res[j + 1].first) res[j + 1].first = res[j].first;
for (int j = 0; j < T; j++) {
//assert(res[j].first >= cur[j].first+1);
if(!j || res[j].first != res[j-1].first);
restrictions[i].push_back({ cur[j].first+1, res[j].first }); //start, end
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:91:25: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   91 |     if (yes >= 0 && yes <= restriction.size()) Y = max(Y, restriction[yes].second);
      |                     ~~~~^~~~~~~~~~~~~~~~~~~~~
#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...