Submission #871504

# Submission time Handle Problem Language Result Execution time Memory
871504 2023-11-11T04:39:13 Z Muhammad_Aneeq ICC (CEOI16_icc) C++17
7 / 100
209 ms 852 KB
#include <set>
#include <vector>
#include "icc.h"
using namespace std;
int const N=110;
vector<int>chi[N]={};
int par[N]={};
set<int>roots;
bool check(vector<int>a,vector<int>b)
{
  int* c=new int[a.size()];int *d=new int[b.size()];
  for (int i=0;i<a.size();i++)
    c[i]=a[i];
  for (int i=0;i<b.size();i++)
    d[i]=b[i];
  int z=query(a.size(),b.size(),c,d);
  return z;
}
void cq(int l,int r)
{
  set<int>a,b;
  for (auto i:chi[l])
    a.insert(i);
  for (auto i:chi[r])
    b.insert(i);
  int x=*(begin(a));
  while (a.size())
  {
    x=*begin(a);
    a.erase(x);
    if (check({begin(a),end(a)},{begin(b),end(b)})==0)
      break;
  }
  int y=*begin(b);
  while (b.size())
  {
    y=*begin(b);
    b.erase(y);
    if (check({x},{begin(b),end(b)})==0)
      break;
  }
  setRoad(x,y);
}
void merge1(int i,int j)
{
  for (auto k:chi[j])
    chi[i].push_back(k);
  par[j]=1;
  chi[j]={};
}
void naive()
{
  for (auto i:roots)
  {
    for (auto j:roots)
    {
      if (j<=i)
        continue;
      if (check(chi[i],chi[j]))
      {
        cq(i,j);
        merge1(i,j);
      }
    }
  }
}
void run(int n)
{
  for (int i=1;i<=n;i++)
  {
    roots.insert(i);
    par[i]=i;
    chi[i].push_back(i);
  }
  for (int i=0;i<n-1;i++)
  {
    naive();
  }
}

Compilation message

icc.cpp: In function 'bool check(std::vector<int>, std::vector<int>)':
icc.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for (int i=0;i<a.size();i++)
      |                ~^~~~~~~~~
icc.cpp:14:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |   for (int i=0;i<b.size();i++)
      |                ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 22 ms 604 KB Ok! 1472 queries used.
2 Correct 22 ms 600 KB Ok! 1472 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 173 ms 776 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 209 ms 848 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 191 ms 852 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 181 ms 660 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 684 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -