Submission #388475

# Submission time Handle Problem Language Result Execution time Memory
388475 2021-04-11T16:13:01 Z fadi57 Library (JOI18_library) C++14
0 / 100
288 ms 436 KB
#include <cstdio>
#include<bits/stdc++.h>
#include <vector>
#include "library.h"
//#include "grader.cpp"
using namespace std;
const int mx=1000;
int l[mx];
int r[mx];
vector<int>adj[mx];
int vis[mx];
void Solve(int N)
{
	vector<int> M(N);

	for(int i = 0; i < N; i++) {
		M[i] = 0;
	}

	map<int,int>mp;
   for(int i=0;i<N;i++){
    M[i]=1;
    for(int  j=i+1;j<N;j++){

        M[j]=1;
        int z=Query(M);
        if(z==1){
          adj[i].push_back(j);
          adj[j].push_back(i);
        }
        M[j]=0;
     }
     M[i]=0;
   }

   int s;
     for(int i=0;i<N;i++){
     if(adj[i].size()==1){

      s=i;break;
     }
   }

vector <int> res;
 queue<int>q;
 q.push(s);
  vis[s]=1;
 res[0]=s;
 int i=0;

 while(q.size()){

    int me=q.front();

    q.pop();
  res.push_back(me+1);
    vis[me]=1;
    for(auto it:adj[me]){
        if(vis[it]){continue;}
        q.push(it);
        vis[it]=1;

    }
    i++;
 }


	Answer(res);
}
# Verdict Execution time Memory Grader output
1 Runtime error 288 ms 436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 288 ms 436 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -