답안 #1087435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087435 2024-09-12T17:49:07 Z juicy 보물 찾기 (CEOI13_treasure2) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

bool res[105][105];

int qry(int a, int b, int c, int d) {
  cout << a << " " << b << " " << c << " " << d << endl;
  int x; cin >> x;
  return x;
}

void rec(int a, int b, int c, int d, int cnt) {
  if (tie(a, b) == tie(c, d)) {
    res[a][b] = 1;
    return;
  }
  if (rng() % 2 && a != c) {
    int m = (a + c) / 2;
    int x = qry(a, b, m, d);
    if (x) {
      rec(a, b, m, d, x);
    }
    if (x < cnt) {
      rec(m + 1, b, c, d, cnt - x);
    }
  } else {
    int m = (b + d) / 2;
    int x = qry(a, b, c, m);
    if (x) {
      rec(a, b, c, m, x);
    }
    if (x < cnt) {
      rec(a, m + 1, c, d, cnt - x);
    } 
  }
}

int main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);
  
  int n; cin >> n;
  for (int i = 1; i <= n; ++i) {
    fill(res[i] + 1, res[i] + n + 1, 0);
  }
  rec(1, 1, n, n, qry(1, 1, n, n));
  cout << "END" << endl;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      cout << res[i][j];
    }
    cout << endl;
  }
  return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccO8po3l.o: in function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccuMEoJn.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccuMEoJn.o: in function `main':
grader.c:(.text.startup+0x103): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status