Submission #259932

#TimeUsernameProblemLanguageResultExecution timeMemory
259932SortingTreasure (different grader from official contest) (CEOI13_treasure2)C++17
69 / 100
1 ms512 KiB
#include "treasure.h"
#include <bits/stdc++.h>

using namespace std;

const int k_N = 100 + 3;

int n;
int sum[2][2][k_N][k_N];
int ans[k_N][k_N];

void findTreasure(int _n){
    n = _n;

    int a = n / 2 + n % 2, b = n - a;

    for(int i = 0; i < 2; ++i){
        for(int j = 0; j < 2; ++j){
            int x1, x2, y1, y2;
            int r, c;
            int xd, yd;

            if(i == 0) x1 = a, x2 = n, r = 1;
            else x1 = 1, x2 = a + 1, r = n;
            
            if(j == 0) y1 = a, y2 = n, c = 1;
            else y1 = 1, y2 = a + 1, c = n;

            for(int x = x1; x <= x2; ++x)
                for(int y = y1; y <= y2; ++y)
                    sum[i][j][x][y] = countTreasure(min(x, r), min(y, c), max(x, r), max(y, c));

            if(i == 0) x1 = a + 1, x2 = n, xd = -1;
            else x1 = 1, x2 = a, xd = 1;
            
            if(j == 0) y1 = a + 1, y2 = n, yd = -1;
            else y1 = 1, y2 = a, yd = 1;

            for(int x = x1; x <= x2; ++x)
                for(int y = y1; y <= y2; ++y)
                    ans[x][y] = sum[i][j][x][y] - sum[i][j][x + xd][y] - sum[i][j][x][y + yd] + sum[i][j][x + xd][y + yd];
        }
    }

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

Compilation message (stderr)

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:15:28: warning: unused variable 'b' [-Wunused-variable]
     int a = n / 2 + n % 2, b = n - a;
                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...