Submission #840763

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8407632023-08-31 16:48:02firewaterLongest Trip (IOI23_longesttrip)C++17
100 / 100
21 ms2824 KiB
#include<bits/stdc++.h>
#include "longesttrip.h"
#define MX 100100
using namespace std;
int n,now,x,y,z,xx,yy,gg,zz,to[MX];
vector<int>A,B,ans,ans1,ans2,a[MX];
// queue<int>d;
// bool are_connected(std::vector<int> A, std::vector<int> B)
bool check(int x,int y)
{
A.clear();B.clear();
A.push_back(x);
B.push_back(y);
return are_connected(A,B);
}
bool checkk(int x,vector<int> G)
{
A.clear();
A.push_back(x);
return are_connected(A,G);
}
bool checkkk(int x,vector<int> G)
{
A.clear();
for(int i=0;i<=x;++i)
A.push_back(ans1[i]);
return are_connected(A,G);
}
bool checkkkk(int x,int y)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

longesttrip.cpp: In function 'void dfs(int, int)':
longesttrip.cpp:42:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |     for(int i=0;i<a[x].size();++i)
      |                 ~^~~~~~~~~~~~
longesttrip.cpp: In function 'void dfss(int, int)':
longesttrip.cpp:50:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |     for(int i=0;i<a[x].size();++i)
      |                 ~^~~~~~~~~~~~
longesttrip.cpp: In function 'std::vector<int> longest_trip(int, int)':
longesttrip.cpp:126:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  126 |             for(int i=0;i<ans2.size();++i)
      |                         ~^~~~~~~~~~~~
longesttrip.cpp:136:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  136 |             for(int i=0;i<ans1.size();++i)
      |                         ~^~~~~~~~~~~~
longesttrip.cpp:138:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  138 |             for(int i=0;i<ans2.size();++i)
      |                         ~^~~~~~~~~~~~
longesttrip.cpp:142:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  142 |             for(int i=0;i<ans1.size();++i)
      |                         ~^~~~~~~~~~~~
longesttrip.cpp:151:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  151 |             int mid=l+r>>1;
      |                     ~^~
longesttrip.cpp:158:22: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  158 |             int mid=l+r>>1;
      |                     ~^~
longesttrip.cpp:163:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  163 |                for(int k=i+1;k<ans1.size();++k)
      |                              ~^~~~~~~~~~~~
longesttrip.cpp:167:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
  167 |                for(int k=j;k<ans2.size();++k)
      |                            ~^~~~~~~~~~~~
#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...