Submission #70708

# Submission time Handle Problem Language Result Execution time Memory
70708 2018-08-23T09:01:50 Z Just_Solve_The_Problem Park (JOI17_park) C++11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "park.h"
#include "grader.cpp"

using namespace std;

static int Place[1400];
int n;

void solve1() {
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      Place[i] = Place[j] = 1;
      if (Ask(i, j, Place)) {
        Answer(i, j);
      }
      Place[i] = Place[j] = 0;
    }
  }
}

int used[1400];
int deg[1400];

void solve2() {
  vector < int > vec(n);
  iota(vec.begin(), vec.end(), 0);
  random_shuffle(vec.begin(), vec.end());
  for (int i = 0; i < n; i++) {
    int a = vec[i];
    if (deg[a] > 1) continue;
    for (int j = 0; j < n; j++) {
      int b = vec[j];
      if (used[b]) continue;
      if (deg[a] > 1) break;
      Place[a] = Place[b] = 1;
      bool fl = 0;
      if (a > b) swap(a, b), fl = 1;
      if (Ask(a, b, Place)) {
        Answer(a, b);
        deg[a]++;
        deg[b]++;
        used[a] = 1;
        used[b] = 1;
      }
      if (fl) {
        swap(a, b);
      }
      Place[a] = Place[b] = 0;
    }
  }
}

void Detect(int T, int N) {
  srand(time(0));
  n = N;
  if (T == 1) {
    solve1();
  } else if (T == 2) {
    solve2();
  } else {

  }
}

Compilation message

/tmp/ccns1lzo.o: In function `Answer(int, int)':
grader.cpp:(.text+0xc0): multiple definition of `Answer(int, int)'
/tmp/ccrTesBz.o:park.cpp:(.text+0xc0): first defined here
/tmp/ccns1lzo.o: In function `Ask(int, int, int*)':
grader.cpp:(.text+0x170): multiple definition of `Ask(int, int, int*)'
/tmp/ccrTesBz.o:park.cpp:(.text+0x170): first defined here
/tmp/ccns1lzo.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccrTesBz.o:park.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status