제출 #1167996

#제출 시각아이디문제언어결과실행 시간메모리
1167996SangLongest Trip (IOI23_longesttrip)C++20
5 / 100
3 ms416 KiB
#ifndef _Pbrngw_ #include "longesttrip.h" #endif // _Pbrngw_ #include<bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++) #define FORD(i, a, b) for (int i = (a), _b = (b); i >= _b; i--) #define fi first #define se second #define pb push_back #define ALL(a) (a).begin(), (a).end() #define task "kbsiudthw" typedef vector<int> vi; typedef pair<int, int> ii; typedef pair<int, ii> pii; const int N = 1e5 + 5; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 2277; vector<int> longest_trip(int n, int D){ if (D == 3){ vi ans; FOR (i, 0, n - 1) ans.pb(i); return ans; } if (D == 2){ deque<int> ans; ans.pb(0); vector<bool> marked(n, 0); marked[0] = 1; FOR (i, 1, n - 1){ if (are_connected({0}, {i})){ marked[i] = 1; ans.pb(i); break; } } FOR (i, 0, n - 1){ if (marked[i]) continue; if (are_connected({ans.front()}, {i})){ ans.push_front(i); } else ans.pb(i); } vi res; FOR (i, 0, n - 1) res.pb(i); return res; } } #ifdef _Pbrngw_ signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(task".inp", "r")){ freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } return 0; } #endif // _Pbrngw_

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:52:1: warning: control reaches end of non-void function [-Wreturn-type]
   52 | }
      | ^
#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...