답안 #871489

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
871489 2023-11-11T03:11:26 Z Muhammad_Aneeq CEOI16_icc (CEOI16_icc) C++17
0 / 100
194 ms 1620 KB
#include <vector>
#include <set>
#include "icc.h"
using namespace std;
vector<int>g;
bool w=0;
bool q(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];
  return query(a.size(),b.size(),c,d);
}
bool check(int l,int r)
{
  int mid=(l+r)/2;
  vector<int>a,b;
  for (int i=l;i<=mid;i++)
    a.push_back(g[i]);
  for (int i=mid+1;i<=r;i++)
    b.push_back(g[i]);
  return q(a,b);
}
void cq(int l,int r)
{
  int mid=(l+r)/2;
  set<int>a,b;
  for (int i=l;i<=mid;i++)
    a.insert(g[i]);
  for (int i=mid+1;i<=r;i++)
    b.insert(g[i]);
  int x=0;
  while (a.size())
  {
    x=*begin(a);
    a.erase(x);
    if (q({begin(a),end(a)},{begin(b),end(b)})==0)
      break;
  }
  int y=0;
  while (b.size())
  {
    y=*begin(a);
    a.erase(y);
    if (q({x},{begin(b),end(b)})==0)
      break;
  }
  setRoad(x,y);
  x=y;
  vector<int>temp;
  for (auto i:g)
  {
    if (i==x)
      continue;
    else
      temp.push_back(i);
  }
  g=temp;
}
void DnC(int l,int r)
{
  if (r-l+1==1)
    return;
  int mid=(l+r)/2;
  DnC(l,mid);
  DnC(mid+1,r);
  if (!w)
  {
    if (check(l,r))
    {
      w=1;
      cq(l,r);
    }
  }
}
void run(int n)
{
  for (int i=1;i<=n;i++)
    g.push_back(i);
  for (int i=1;i<n;i++)
    DnC(0,g.size()-1);
}

Compilation message

icc.cpp: In function 'bool q(std::vector<int>, std::vector<int>)':
icc.cpp:10:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |   for (int i=0;i<a.size();i++)
      |                ~^~~~~~~~~
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<b.size();i++)
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 100 ms 852 KB Number of queries more than 3000 out of 1500
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 176 ms 1136 KB Number of queries more than 5000 out of 2500
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 194 ms 1620 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 169 ms 1364 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 150 ms 1364 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 138 ms 1364 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -