Submission #790607

# Submission time Handle Problem Language Result Execution time Memory
790607 2023-07-23T00:29:37 Z xiaowuc1 Treasure (different grader from official contest) (CEOI13_treasure2) C++17
Compilation error
0 ms 0 KB
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_set>
#include <vector>

using namespace std;

// BEGIN NO SAD
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
typedef vector<int> vi;
#define f first
#define s second
#define derr if(1) cerr

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
 
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ", "; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? ", " : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#define debug(x...) cerr << "\e[91m"<<__func__<<":"<<__LINE__<<" [" << #x << "] = ["; _print(x); cerr << "\e[39m" << flush;
// END NO SAD

template<class Fun>
class y_combinator_result {
  Fun fun_;
public:
  template<class T>
  explicit y_combinator_result(T &&fun): fun_(std::forward<T>(fun)) {}

  template<class ...Args>
  decltype(auto) operator()(Args &&...args) {
    return fun_(std::ref(*this), std::forward<Args>(args)...);
  }
};

template<class Fun>
decltype(auto) y_combinator(Fun &&fun) {
  return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
}

template<class T>
bool updmin(T& a, T b) {
  if(b < a) {
    a = b;
    return true;
  }
  return false;
}
template<class T>
bool updmax(T& a, T b) {
  if(b > a) {
    a = b;
    return true;
  }
  return false;
}
typedef int64_t ll;
typedef pair<int, int> pii;

void solve() {
  int n;
  cin >> n;
  vector<vector<bool>> ret(n);
  for(auto& x: ret) x.resize(n);
  auto get= [&](int xa, int ya, int xb, int yb) -> int {
    cout << (xa+1) << " " << (ya+1) << " " << (xb+1) << " " << (yb+1) << endl;
    int ret;
    cin >> ret;
    return ret;
  };
  auto dfs = y_combinator([&](auto self, int xa, int ya, int xb, int yb, int amt) -> void {
    if(amt == 0) return;
    if(amt == (xb-xa+1)*(yb-ya+1)) {
      for(int i = xa; i <= xb; i++) for(int j = ya; j <= yb; j++) ret[i][j] = true;
      return;
    }
    if(xb-xa >= yb-ya) {
      int xm = (xa+xb)/2;
      int cand = get(xa, ya, xm, yb);
      self(xa, ya, xm, yb, cand);
      self(xm+1, ya, xb, yb, amt-cand);
    }
    else {
      int ym = (ya+yb)/2;
      int cand = get(xa, ya, xb, ym);
      self(xa, ya, xb, ym, cand);
      self(xa, ym+1, xb, yb, amt-cand);
    }
  });
  dfs(0, 0, n-1, n-1, get(0, 0, n-1, n-1));
  cout << "END\n";
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) cout << (int)(ret[i][j]);
    cout << "\n";
  }
  cout << flush;
}

// what would chika do
// are there edge cases (N=1?)
// are array sizes proper (scaled by proper constant, for example 2* for koosaga tree)
// integer overflow?
// DS reset properly between test cases
// are you doing geometry in floating points
// are you not using modint when you should

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
}

Compilation message

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