Submission #344229

# Submission time Handle Problem Language Result Execution time Memory
344229 2021-01-05T09:45:55 Z beksultan04 Library (JOI18_library) C++14
0 / 100
149 ms 364 KB
#include <cstdio>
#include <vector>
#include "library.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define OK puts("OK");
#define NO puts("NO");
#define YES puts("YES");
#define fr first
#define sc second
#define ret return
#define all(s) s.begin(),s.end()
#define allr(s) s.rbegin(),s.rend()
#define pb push_back
#define sz(v) (int)v.size()
#define endi puts("");
#define eps 1e-12
using namespace std;
vector <int> top,g[1001];

void dfs(int x,int p){
    for (int i=0;i<g[x].size();++i)
        if (g[x][i]!=p)dfs(g[x][i],x);

    top.pb(x);
}


void Solve(int N)
{
	vector<int> m(N);

	for(int i = 0; i < N; i++) {
		m[i] = 0;
	}
    int i,j;
    for (i=0;i<N;++i){
        if (g[i].size() == 2)continue;
        for (j=i+1;j<N;++j){
            if (g[j].size() == 2)continue;
            m[i] = 1;
            m[j] = 1;
            int x = Query(m);
            m[i] = 0;
            m[j] = 0;
            if (x == 1){
                g[i+1].pb(j+1);
                g[j+1].pb(i+1);
            }
        }
    }
    int s=1;
	for (i=0;i<N;++i)
        if (g[i].size() == 1)s=i;
    dfs(s,-1);

	Answer(top);
}

Compilation message

library.cpp: In function 'void dfs(int, int)':
library.cpp:24:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for (int i=0;i<g[x].size();++i)
      |                  ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 364 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 149 ms 364 KB Wrong Answer [4]
2 Halted 0 ms 0 KB -