Submission #836125

#TimeUsernameProblemLanguageResultExecution timeMemory
836125TrumlingThousands Islands (IOI22_islands)C++17
5 / 100
24 ms3028 KiB
#include "islands.h"
#include <variant>
#include <vector>
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define all(x) x.begin(),x.end()
typedef long long ll;
#define pb push_back
#define INF 9999999999999999

variant<bool, vector<int> > find_journey(int N, int M, vector<int> U, vector<int> V) 
{
  int zo,oz,ot,to,zt,tz;

  if(N==2)
  return false;

  for(int i=0;i<M;i++)
  {
  if(U[i]==1 && V[i]==0)
  oz=i;
  if(U[i]==1 && V[i]==2)
  ot=i;

  if(U[i]==0 && V[i]==1)
  zo=i;
   if(U[i]==0 && V[i]==2)
  zt=i;

  if(U[i]==2 && V[i]==1)
  to=i;
  if(U[i]==2 && V[i]==0)
  tz=i;

  }
  vector<int>v={zo,ot,tz,zt,to,oz,tz,ot,zo,oz,to,zt};

  return v;
}

Compilation message (stderr)

islands.cpp: In function 'std::variant<bool, std::vector<int, std::allocator<int> > > find_journey(int, int, std::vector<int>, std::vector<int>)':
islands.cpp:39:52: warning: 'tz' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |   vector<int>v={zo,ot,tz,zt,to,oz,tz,ot,zo,oz,to,zt};
      |                                                    ^
islands.cpp:39:52: warning: 'zt' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:39:52: warning: 'to' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:39:52: warning: 'ot' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:39:52: warning: 'oz' may be used uninitialized in this function [-Wmaybe-uninitialized]
islands.cpp:39:52: warning: 'zo' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...