제출 #888753

#제출 시각아이디문제언어결과실행 시간메모리
888753ZHIRDILBILDIZ가장 긴 여행 (IOI23_longesttrip)C++17
5 / 100
6 ms600 KiB
#include<bits/stdc++.h> #include "longesttrip.h" #define fi first #define se second #define ll long long using namespace std; const int N = 256; //bool gr[N + 1][N + 1]; //bool are_connected(vector<int> a, vector<int> b) { // for (int i : a) // for (int j : b) // if (gr[i][j]) // return 1; // return 0; //} vector<int> longest_trip(int n, int d) { vector<int> v; bool us[N + 1][N + 1] = {}; int dp[N + 1] = {}; for (int i = 0; i < n; ++i) us[i][i] = 1; if (d == 3) { for (int i = 0; i < n; ++i) v.push_back(i); return v; } if (d == 2) { v.push_back(0); int abu = 1; for (int i = 0; i < n - 1, abu < n;) { vector<int> a = {i}, b = {abu}; if (are_connected(a, b)) { v.push_back(abu); i = abu; ++abu; } else { if (abu < n - 2) { v.push_back(abu + 1); v.push_back(abu); i = abu; abu += 2; } else break; } } return v; } } //signed main() { // ios::sync_with_stdio(0); // cin.tie(0); cout.tie(0); // int n, d, m; // cin >> n >> d >> m; // for (int i = 1; i <= m; ++i) { // int a, b; // cin >> a >> b; // gr[a][b] = gr[b][a] = 1; // } // vector<int> ans = longest_trip(n, d); // cout << ans.size() << '\n'; // for (int i : ans) // cout << i << ' '; // cout << "\nare connected\n"; // return 0; //} //5 2 8 //0 2 //0 3 //0 4 //1 2 //1 3 //1 4 //2 4 //3 4

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

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:30:27: warning: left operand of comma operator has no effect [-Wunused-value]
   30 |         for (int i = 0; i < n - 1, abu < n;) {
      |                         ~~^~~~~~~
longesttrip.cpp:18:10: warning: variable 'us' set but not used [-Wunused-but-set-variable]
   18 |     bool us[N + 1][N + 1] = {};
      |          ^~
longesttrip.cpp:19:9: warning: unused variable 'dp' [-Wunused-variable]
   19 |     int dp[N + 1] = {};
      |         ^~
longesttrip.cpp:48:1: warning: control reaches end of non-void function [-Wreturn-type]
   48 | }
      | ^
#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...