Submission #159448

# Submission time Handle Problem Language Result Execution time Memory
159448 2019-10-22T18:27:22 Z InfiniteJest ICC (CEOI16_icc) C++14
7 / 100
407 ms 636 KB
#include <iostream>
#include <fstream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <map>
#include "icc.h"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
 
ifstream in("input.txt");
ofstream out("output.txt");
 
typedef long long ll;
 
int n;
vector<int> nodi[101];
bool vis[101];
bool pres[101][101];
int ar,br;
 
 
//int query(int size_a, int size_b, int a[], int b[]);
 
//void setRoad(int a, int b);
 
void dfs(int k){
  vis[k]=1;
  for(int i=0;i<(int)nodi[k].size();i++){
    if(vis[nodi[k][i]])continue;
    vis[nodi[k][i]]=1;
    dfs(nodi[k][i]);
  }
}
 
void run(int N){
  n=N;
  for(int i=0;i<n-1;i++){
    bool flag=1;
    for(int y=1;y<=n&&flag;y++){
      int tot=0;
      for(int j=1;j<=n;j++){
        vis[j]=0;
      }
      dfs(y);
      vector<int> a;
      for(int j=1;j<=n;j++){
        if(!vis[j])a.pb(j);
      }
      tot=(int)a.size();
      int f[tot];
      int g[1];
      g[0]=y;
      for(int j=0;j<tot;j++)f[j]=a[j];
      if(query(1,tot,g,f)){
        for(int j=1;j<=n;j++){
          if(vis[j])continue;
          int p[1];
          int b[1];
          p[0]=y;
          b[0]=j;
          if(query(1,1,p,b)){
            setRoad(y,j);
            nodi[y].pb(j);
            nodi[j].pb(y);
            flag=0;
            break;
          }
        }
      }
 
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 21 ms 504 KB Ok! 301 queries used.
2 Correct 20 ms 632 KB Ok! 293 queries used.
# Verdict Execution time Memory Grader output
1 Incorrect 260 ms 636 KB Too many queries! 3605 out of 2500
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 407 ms 632 KB Number of queries more than 4500 out of 2250
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 386 ms 564 KB Number of queries more than 4000 out of 2000
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 324 ms 564 KB Number of queries more than 3550 out of 1775
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 295 ms 568 KB Number of queries more than 3250 out of 1625
2 Halted 0 ms 0 KB -