Submission #47827

# Submission time Handle Problem Language Result Execution time Memory
47827 2018-05-08T05:17:55 Z Talant Library (JOI18_library) C++17
19 / 100
2000 ms 796 KB
#include <cstdio>
#include <vector>
#include <bits/stdc++.h>
#include "library.h"

#define pb push_back
using namespace std;

int deg[1005];
vector <int> g[1005],res;

void dfs (int v,int p = -1) {
      res.pb(v + 1);
      for (auto to : g[v])
            if (to != p)
                  dfs(to,v);
}
void Solve(int N)
{
	vector<int> M(N);

      int cur = 0;

      for (int i = 0; i < N; i ++) {
            for (int j = i + 1; j < N; j ++) {
                  M[i] = M[j] = 1;
                  int o = Query(M);
                  if (o == 1) {
                        g[i].pb(j);
                        g[j].pb(i);
                        deg[i] ++;
                        deg[j] ++;
                  }
                  M[i] = M[j] = 0;
            }
      }
      for (int i = 0; i < N; i ++) {
            if (deg[i] == 1) {
                  cur = i;
                  break;
            }
      }
      dfs(cur);

	Answer(res);
}
# Verdict Execution time Memory Grader output
1 Correct 229 ms 420 KB Output is correct
2 Correct 253 ms 420 KB Output is correct
3 Correct 294 ms 420 KB Output is correct
4 Correct 302 ms 596 KB Output is correct
5 Correct 311 ms 604 KB Output is correct
6 Correct 287 ms 668 KB Output is correct
7 Correct 304 ms 796 KB Output is correct
8 Correct 277 ms 796 KB Output is correct
9 Correct 290 ms 796 KB Output is correct
10 Correct 74 ms 796 KB Output is correct
11 Correct 2 ms 796 KB Output is correct
12 Correct 2 ms 796 KB Output is correct
13 Correct 2 ms 796 KB Output is correct
14 Correct 2 ms 796 KB Output is correct
15 Correct 3 ms 796 KB Output is correct
16 Correct 6 ms 796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 229 ms 420 KB Output is correct
2 Correct 253 ms 420 KB Output is correct
3 Correct 294 ms 420 KB Output is correct
4 Correct 302 ms 596 KB Output is correct
5 Correct 311 ms 604 KB Output is correct
6 Correct 287 ms 668 KB Output is correct
7 Correct 304 ms 796 KB Output is correct
8 Correct 277 ms 796 KB Output is correct
9 Correct 290 ms 796 KB Output is correct
10 Correct 74 ms 796 KB Output is correct
11 Correct 2 ms 796 KB Output is correct
12 Correct 2 ms 796 KB Output is correct
13 Correct 2 ms 796 KB Output is correct
14 Correct 2 ms 796 KB Output is correct
15 Correct 3 ms 796 KB Output is correct
16 Correct 6 ms 796 KB Output is correct
17 Execution timed out 2029 ms 796 KB Time limit exceeded
18 Halted 0 ms 0 KB -