제출 #1172357

#제출 시각아이디문제언어결과실행 시간메모리
1172357dion3249월 (APIO24_september)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int solve(ll N, ll M, vector<ll> F, vector<vector<ll>> S) { if (S.size() == 1) { return S[0].size(); } vector<int> indices(M, 0); ll total = M * (N - 1); ll ctr = 0; queue<int> q; q.push(S[0][0]); // indices[0] += 1; ll days = 0; unordered_set<int> visited = {S[0][0]}; while (ctr < total) { days += 1; while (!q.empty()) { ll leaf = q.front(); q.pop(); for (int j = 0; j < M; ++j) { for (int k = 0; k < N - 1; ++k) { if (indices[j] >= N - 1) { continue; } if (S[j][indices[j]] != leaf && visited.find(S[j][indices[j]]) == visited.end()) { q.push(S[j][indices[j]]); visited.insert(S[j][indices[j]]); indices[j]++; ctr++; } else { indices[j]++; ctr++; break; } } } } } return days; }

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

september.cpp: In function 'int solve(ll, ll, std::vector<long long int>, std::vector<std::vector<long long int> >)':
september.cpp:18:42: warning: narrowing conversion of '(& S.std::vector<std::vector<long long int> >::operator[](0))->std::vector<long long int>::operator[](0)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
   18 |     unordered_set<int> visited = {S[0][0]};
      |                                          ^
september.cpp:18:42: warning: narrowing conversion of '(& S.std::vector<std::vector<long long int> >::operator[](0))->std::vector<long long int>::operator[](0)' from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' [-Wnarrowing]
/usr/bin/ld: /tmp/ccBobOlk.o: in function `mtbpdhr2zxjo1o4i9oreohsbuzzl4s6u::taskcase()':
grader.cpp:(.text+0x50d): undefined reference to `solve(int, int, std::vector<int, std::allocator<int> >, std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >)'
collect2: error: ld returned 1 exit status