Submission #464573

# Submission time Handle Problem Language Result Execution time Memory
464573 2021-08-13T12:57:29 Z zxcvbnm Treasure (different grader from official contest) (CEOI13_treasure2) C++14
0 / 100
49 ms 2064 KB
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;
int n;
bool ans[105][105];
map<array<int, 4>, int> call;
int query(int x1, int y1, int x2, int y2) {
    if (x1 > x2) swap(x1, x2);
    if (y1 > y2) swap(y1, y2);
//    cerr << x1 << " " << y1 << " " << x2 << " " << y2 << "\n";
    if (x1 <= 0 || x2 <= 0 || x2 > n || x1 > n || y1 <= 0 || y1 > n || y2 <= 0 || y2 > n) return 0;
    if (call.count({x1, y1, x2, y2})) {
        return call[{x1, y1, x2, y2}];
    }
    return call[{x1, y1, x2, y2}] = countTreasure(x1, y1, x2, y2);
}

int quadrant(int x, int y, int dx[], int dy[]) {
    vector<int> poss;
    for(int i = 0; i < 4; i++) {
        poss.push_back(abs(dx[i]-x) * abs(dy[i]-y));
    }
    return rand() % 4;
    return min_element(poss.begin(), poss.end()) - poss.begin();
}
void findTreasure (int N) {
    n = N;

    int dx[] = {1, n, 1, n};
    int dy[] = {1, 1, n, n};

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            int idx = quadrant(i, j, dx, dy);
            int x1 = min(dx[idx], i);
            int x2 = max(dx[idx], i);
            int y1 = min(dy[idx], j);
            int y2 = max(dy[idx], j);
//            int x1 = dx[idx];
//            int y1 = dy[idx];
//            int x2 = i;
//            int y2 = j;

            if (idx == 0) {
                ans[i][j] = query(x1, y1, x2, y2) - query(x1, y1, x2-1, y2) - query(x1, y1, x2, y2-1) + query(x1, y1, x2-1, y2-1);
            }
            else if (idx == 1) {
                ans[i][j] = query(x1, y1, x2, y2) - query(x1+1, y1, x2, y2) - query(x1, y1, x2, y2-1) + query(x1+1, y1, x2, y2-1);
            }
            else if (idx == 2) {
                ans[i][j] = query(x1, y1, x2, y2) - query(x1, y1+1, x2, y2) - query(x1, y1, x2-1, y2) + query(x1, y1+1, x2-1, y2);
            }
            else if (idx == 3) {
                ans[i][j] = query(x1, y1, x2, y2) - query(x1+1, y1, x2, y2) - query(x1, y1+1, x2, y2) + query(x1+1, y1+1, x2, y2);
            }
        }
    }

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            if (ans[i][j]) {
                Report(i, j);
            }
            cerr << ans[i][j] << " ";
        }
        cerr << "\n";
    }

//    int cnt = countTreasure(1, 1, N, N);
//    if(cnt > 0) Report(1, 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct - N = 5, K = 1011, score = 0
2 Incorrect 1 ms 332 KB Output isn't correct - N = 10, K = 17901, score = 0
3 Incorrect 2 ms 332 KB Output isn't correct - N = 15, K = 95530, score = 0
4 Incorrect 2 ms 332 KB Output isn't correct - N = 16, K = 125084, score = 0
5 Incorrect 15 ms 792 KB Output isn't correct - N = 55, K = 18303178, score = 0
6 Incorrect 21 ms 1068 KB Output isn't correct - N = 66, K = 38294291, score = 0
7 Incorrect 34 ms 1376 KB Output isn't correct - N = 77, K = 70958267, score = 0
8 Incorrect 46 ms 1668 KB Output isn't correct - N = 88, K = 120437655, score = 0
9 Incorrect 48 ms 1996 KB Output isn't correct - N = 99, K = 194517113, score = 0
10 Incorrect 49 ms 2064 KB Output isn't correct - N = 100, K = 202542291, score = 0