Submission #388455

# Submission time Handle Problem Language Result Execution time Memory
388455 2021-04-11T15:29:52 Z fadi57 Library (JOI18_library) C++14
Compilation error
0 ms 0 KB
#include <cstdio>
#include<bits/stdc++.h>
#include <vector>
#include "library.h"
#include "grader.cpp"
using namespace std;
const int mx=10000;
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;
	}
	memset(l,-1,mx);
	memset(r,-1,mx);
	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;
     }
   }
   int left=-1;int right=-1;
   int s;
     for(int i=0;i<N;i++){
     if(adj[i].size()==1){

      s=i;break;
     }
   }

vector <int> res(N);
 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[i]=me+1;
    for(auto it:adj[me]){
        if(vis[it]){continue;}
        q.push(it);
        vis[it]=1;
    }
    i++;
 }


	Answer(res);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:19:16: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
   19 |  memset(l,-1,mx);
      |                ^
library.cpp:20:16: warning: 'memset' used with length equal to number of elements without multiplication by element size [-Wmemset-elt-size]
   20 |  memset(r,-1,mx);
      |                ^
library.cpp:35:8: warning: unused variable 'left' [-Wunused-variable]
   35 |    int left=-1;int right=-1;
      |        ^~~~
library.cpp:35:20: warning: unused variable 'right' [-Wunused-variable]
   35 |    int left=-1;int right=-1;
      |                    ^~~~~
/tmp/ccTWHXBY.o: In function `Query(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x40): multiple definition of `Query(std::vector<int, std::allocator<int> > const&)'
/tmp/ccpfh8Fm.o:grader.cpp:(.text+0x0): first defined here
/tmp/ccTWHXBY.o:(.bss+0x57e40): multiple definition of `__my_judge_::judge'
/tmp/ccpfh8Fm.o:(.bss+0x0): first defined here
/tmp/ccTWHXBY.o: In function `Answer(std::vector<int, std::allocator<int> > const&)':
library.cpp:(.text+0x50): multiple definition of `Answer(std::vector<int, std::allocator<int> > const&)'
/tmp/ccpfh8Fm.o:grader.cpp:(.text+0x390): first defined here
/tmp/ccTWHXBY.o: In function `main':
library.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccpfh8Fm.o:grader.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status