제출 #1046425

#제출 시각아이디문제언어결과실행 시간메모리
10464250npata추월 (IOI23_overtaking)C++17
39 / 100
3575 ms604 KiB
#include "overtaking.h" #include<bits/stdc++.h> using namespace std; #define int long long #define vec vector struct Line { int a; int b; }; const int MXN = 105; const int MXQ = 105; const int MXM = 105; vec<int32_t> s; int n; int x; struct Bus { int t; int w; int i; }; vec<Bus> buses; 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) { s = S; n = N; x = X; buses = vec<Bus>(n+1); for(int i = 0; i<n; i++) { buses[i] = {T[i], W[i], i}; } return; } long long arrival_time(long long Y) { auto buses_copy = buses; buses[n] = {Y, x, n}; for(int i = 1; i<s.size(); i++) { sort(buses.begin(), buses.end(), [](auto& b1, auto& b2) {return b1.t == b2.t ? (b1.w < b2.w) : b1.t<b2.t;}); int mxt = 0; for(auto& bus : buses) { bus.t = max(mxt, bus.t+bus.w*(s[i]-s[i-1])); mxt = max(bus.t, mxt); } } for(auto bus : buses) { if(bus.i == n) { buses = buses_copy; return bus.t; } } return -1; }

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

overtaking.cpp: In function 'long long int arrival_time(long long int)':
overtaking.cpp:51:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   51 |  for(int i = 1; i<s.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...