제출 #1064896

#제출 시각아이디문제언어결과실행 시간메모리
1064896j_vdd16던전 (IOI21_dungeons)C++17
컴파일 에러
0 ms0 KiB
#include "dungeons.h" #include <algorithm> #include <bitset> #include <cstdint> #include <cstring> #include <iostream> #include <limits.h> #include <math.h> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#define int long long #define ll long long #define loop(X, N) for(int X = 0; X < (N); X++) #define all(V) V.begin(), V.end() #define rall(V) V.rbegin(), V.rend() using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<vector<ii>> vvii; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; typedef uint64_t u64; typedef int64_t i64; int n; vector<ll> s, p; vi w, l; void init(int _n, std::vector<int> _s, std::vector<int> _p, std::vector<int> _w, std::vector<int> _l) { n = _n; w = _w; l = _l; w.push_back(n); l.push_back(n); //set<ll> strengths; for (int x : _s) { s.push_back(x); //strengths.insert(x); } for (int x : _p) p.push_back(x); s.push_back(0); p.push_back(0); } long long simulate(int x, int _z) { int start = x; ll z = _z; while (x != n) { ll minAlong = LLONG_MAX; ll sumAlong = 0; do { if (z >= s[x]) { z += s[x]; sumAlong += s[x]; x = w[x]; } else { z += p[x]; sumAlong += p[x]; x = l[x]; minAlong = min(minAlong, s[x]); } } while (x != start && x != n); if (x == n) break; if (z < minAlong) { int count = (minAlong - z + sumAlong - 1) / sumAlong; z += sumAlong * count; } } return z; } int main() { init(3, {2, 6, 9}, {3, 1, 2}, {2, 2, 3}, {1, 0, 1}); cout << simulate(0, 1) << endl; }

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

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