#include "treasure.h"
#include <iostream>
#define MAXN 100
using namespace std;
int ps[MAXN + 5][MAXN + 5]; // partial sum # treasure
int ans[MAXN + 5][MAXN + 5];
int total = 0;
void query(int r1, int c1, int r2, int c2) {
cout << r1 << " " << c1 << " " << r2 << " " << c2 << endl;
total += (r2 - r1 + 1) * (c2 - c1 + 1);
}
int main() {
int N;
cin >> N;
query(1, 1, N, N);
cin >> ps[N][N];
for (int r = N; r >= 2; r--) {
for (int c = N; c >= 2; c--) {
if (!ps[r][c - 1]) {
query(1, 1, r, c - 1);
cin >> ps[r][c - 1];
}
if (!ps[r - 1][c - 1]) {
query(1, 1, r - 1, c - 1);
cin >> ps[r - 1][c - 1];
}
if (!ps[r - 1][c]) {
query(1, 1, r - 1, c);
cin >> ps[r - 1][c];
}
ans[r][c] = ps[r][c] - ps[r - 1][c] - ps[r][c - 1] + ps[r - 1][c - 1];
}
}
for (int r = N; r >= 1; r--) {
ans[r][1] = ps[r][2] - ps[r - 1][2] - ans[r][2];
}
for (int c = N; c >= 1; c--) {
ans[1][c] = ps[2][c] - ps[2][c-1] - ans[2][c];
}
for (int r = 1; r <= N; r++) {
for (int c = 1; c <= N; c++) {
cout << ans[r][c];
}
cout << endl;
}
cout << total;
}
Compilation message
/usr/bin/ld: /tmp/ccTpPR9N.o: in function `main':
treasure.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccnLWLLR.o:grader.c:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccnLWLLR.o: in function `main':
grader.c:(.text.startup+0x103): undefined reference to `findTreasure(int)'
collect2: error: ld returned 1 exit status