Submission #850145

#TimeUsernameProblemLanguageResultExecution timeMemory
850145RifalLongest Trip (IOI23_longesttrip)C++17
15 / 100
6 ms600 KiB
#include "longesttrip.h" using namespace std; #include<bits/stdc++.h> std::vector<int> longest_trip(int N, int D) { vector<int> ans; if(D == 3) { for(int i = 0; i < N; i++) { ans.push_back(i); } } else if(D == 2) { set<int> st; deque<int> dq; for(int i = 1; i < N; i++) st.insert(i); dq.push_back(0); if(are_connected({dq.back()}, {1}) == true) { dq.push_back(1); st.erase(1); } else { dq.push_back(2); st.erase(2); } for(auto i : st) { if(are_connected({dq.back()}, {i}) == true) { dq.push_back(i); } else { dq.push_front(i); } } for(int i = 0; i < dq.size(); i++) { ans.push_back(dq[i]); } } else { } return ans; }

Compilation message (stderr)

longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:31:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(int i = 0; i < dq.size(); i++) {
      |                        ~~^~~~~~~~~~~
#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...