Submission #1281184

#TimeUsernameProblemLanguageResultExecution timeMemory
1281184repmannGame (IOI14_game)C++20
42 / 100
24 ms9360 KiB
#include <bits/stdc++.h>
using namespace std;
int N;
bool V[80];
bool VG[80][80];
inline void DFS(int node)
{
  V[node] = 1;
  for(int i = 0; i < N; i++)
  {
    if(!VG[node][i] || V[i]) continue;
    DFS(i);
  }
  return;
}
void initialize(int n)
{
  N = n;
  for(int i = 0; i < N; i++)
  {
    for(int j = 0; j < N; j++) VG[i][j] = 1;
  }
  return;
}
int hasEdge(int u, int v)
{
  for(int i = 0; i < N; i++) V[i] = 0;
  VG[u][v] = VG[v][u] = 0;
  DFS(0);
  bool flag = 1;
  for(int i = 0; i < N; i++) flag &= V[i];
  if(flag) return 0;
  VG[u][v] = VG[v][u] = 1;
  return 1;
}
//int main()
//{
//  int n, u, v;
//  cin >> n;
//  initialize(n);
//  for(int i = (n * (n - 1)) >> 1; i; i--)
//  {
//    cin >> u >> v;
//    bool ret = hasEdge(u, v);
//    if(ret) cout << "yes\n";
//    else cout << "no\n";
//  }
//  return 0;
//}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...