답안 #344228

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344228 2021-01-05T09:44:23 Z beksultan04 도서관 (JOI18_library) C++14
19 / 100
379 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){
        for (j=i+1;j<N;++j){
            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)
      |                  ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 300 ms 364 KB # of queries: 18336
2 Correct 262 ms 620 KB # of queries: 18145
3 Correct 322 ms 492 KB # of queries: 19900
4 Correct 196 ms 528 KB # of queries: 19900
5 Correct 290 ms 620 KB # of queries: 19900
6 Correct 202 ms 620 KB # of queries: 19900
7 Correct 285 ms 492 KB # of queries: 19900
8 Correct 247 ms 364 KB # of queries: 18528
9 Correct 315 ms 492 KB # of queries: 19701
10 Correct 107 ms 492 KB # of queries: 8256
11 Correct 1 ms 364 KB # of queries: 0
12 Correct 0 ms 364 KB # of queries: 1
13 Correct 1 ms 364 KB # of queries: 3
14 Correct 1 ms 364 KB # of queries: 6
15 Correct 2 ms 364 KB # of queries: 105
16 Correct 6 ms 364 KB # of queries: 351
# 결과 실행 시간 메모리 Grader output
1 Correct 300 ms 364 KB # of queries: 18336
2 Correct 262 ms 620 KB # of queries: 18145
3 Correct 322 ms 492 KB # of queries: 19900
4 Correct 196 ms 528 KB # of queries: 19900
5 Correct 290 ms 620 KB # of queries: 19900
6 Correct 202 ms 620 KB # of queries: 19900
7 Correct 285 ms 492 KB # of queries: 19900
8 Correct 247 ms 364 KB # of queries: 18528
9 Correct 315 ms 492 KB # of queries: 19701
10 Correct 107 ms 492 KB # of queries: 8256
11 Correct 1 ms 364 KB # of queries: 0
12 Correct 0 ms 364 KB # of queries: 1
13 Correct 1 ms 364 KB # of queries: 3
14 Correct 1 ms 364 KB # of queries: 6
15 Correct 2 ms 364 KB # of queries: 105
16 Correct 6 ms 364 KB # of queries: 351
17 Runtime error 379 ms 364 KB Execution killed with signal 13 (could be triggered by violating memory limits)
18 Halted 0 ms 0 KB -