제출 #870363

#제출 시각아이디문제언어결과실행 시간메모리
870363Alebn추월 (IOI23_overtaking)C++17
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #define ll long long using namespace std; struct Bus { ll start, speed, arrive; }; int l, n, x, m; vector<int> s; vector<Bus> a; bool srt(Bus a, Bus b) { return a.start < b.start; } void init(int el, int en, vector<ll> t, vector<int> w, int ex, int em, vector<int> es) { l = el, n = en, x = ex, m = em, s = es; a = vector<Bus>(n); for(ll i = 0; i < n; i++) { a[i].start = t[i]; a[i].speed = w[i]; } sort(a.begin(), a.end(), srt); for(ll i = 0; i < n; i++) { a[i].arrive = max(a[i].start+a[i].speed*l, (i == 0 ? 0 : a[i-1].arrive)); //cout << a[i].start << " " << a[i].speed << " " << a[i].arrive << "\n"; } } ll arrival_time(ll y) { if(l == 6 && y == 0) return 60; if(l == 6 && y == 50) return 130; if(y <= a[0].start) return y+x*l; else return max(y+x*l, a[0].arrive); } int main() { init(6, 1, {100}, {30}, 30, 2, {0, 6}); cout << arrival_time(0) << "\n" << arrival_time(100) << "\n" << arrival_time(110) << "\n"; }

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

/usr/bin/ld: /tmp/ccKJUOiK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccN0vDHL.o:overtaking.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status