Submission #344230

# Submission time Handle Problem Language Result Execution time Memory
344230 2021-01-05T09:46:50 Z beksultan04 Library (JOI18_library) C++14
19 / 100
336 ms 620 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+1].size() == 2)continue;
        for (j=i+1;j<N;++j){
            if (g[j+1].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 Correct 159 ms 364 KB # of queries: 12639
2 Correct 191 ms 620 KB # of queries: 13346
3 Correct 212 ms 492 KB # of queries: 14103
4 Correct 221 ms 364 KB # of queries: 14987
5 Correct 195 ms 492 KB # of queries: 14879
6 Correct 165 ms 492 KB # of queries: 14661
7 Correct 194 ms 620 KB # of queries: 14811
8 Correct 149 ms 404 KB # of queries: 14128
9 Correct 195 ms 492 KB # of queries: 14232
10 Correct 55 ms 528 KB # of queries: 5988
11 Correct 1 ms 364 KB # of queries: 0
12 Correct 1 ms 364 KB # of queries: 1
13 Correct 1 ms 364 KB # of queries: 3
14 Correct 1 ms 364 KB # of queries: 5
15 Correct 2 ms 364 KB # of queries: 79
16 Correct 5 ms 364 KB # of queries: 275
# Verdict Execution time Memory Grader output
1 Correct 159 ms 364 KB # of queries: 12639
2 Correct 191 ms 620 KB # of queries: 13346
3 Correct 212 ms 492 KB # of queries: 14103
4 Correct 221 ms 364 KB # of queries: 14987
5 Correct 195 ms 492 KB # of queries: 14879
6 Correct 165 ms 492 KB # of queries: 14661
7 Correct 194 ms 620 KB # of queries: 14811
8 Correct 149 ms 404 KB # of queries: 14128
9 Correct 195 ms 492 KB # of queries: 14232
10 Correct 55 ms 528 KB # of queries: 5988
11 Correct 1 ms 364 KB # of queries: 0
12 Correct 1 ms 364 KB # of queries: 1
13 Correct 1 ms 364 KB # of queries: 3
14 Correct 1 ms 364 KB # of queries: 5
15 Correct 2 ms 364 KB # of queries: 79
16 Correct 5 ms 364 KB # of queries: 275
17 Runtime error 336 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
18 Halted 0 ms 0 KB -