Submission #234576

# Submission time Handle Problem Language Result Execution time Memory
234576 2020-05-24T16:53:06 Z wet_water Treasure (different grader from official contest) (CEOI13_treasure2) C++14
10 / 100
5 ms 384 KB
#include <iostream>
#include <algorithm>
#include <queue>
#include <string.h>
#include <math.h>
#include <map>
#include <set>
#include <vector>
#include "treasure.h"

#define MOD 1000000009 
#define MAX_N 105
#define f first
#define s second
 
using namespace std;
 
typedef pair<int, int> ii;
typedef pair<ii, int> pii;
 
int mod_pow(int num, int power)
{
    int test;
    for(test = 1; power; power >>= 1)
    {
        if (power & 1)
            test = (test * num) % MOD;
        num = (num * num) % MOD;
    }
 
    return test;
}

void fastscan(int &number) 
{ 
    //variable to indicate sign of input number 
    bool negative = false; 
    register int c; 
  
    number = 0; 
  
    // extract current character from buffer 
    c = getchar(); 
    if (c=='-') 
    { 
        // number is negative 
        negative = true; 
  
        // extract the next character from the buffer 
        c = getchar(); 
    } 
  
    // Keep on extracting characters if they are integers 
    // i.e ASCII Value lies from '0'(48) to '9' (57) 
    for (; (c>47 && c<58); c=getchar()) 
        number = number *10 + c - 48; 
  
    // if scanned input has a negative sign, negate the 
    // value of the input number 
    if (negative) 
        number *= -1; 
} 

bool cmp(pii a, pii b) {
    return (a.f.s < b.f.s);
}

int ar[MAX_N][MAX_N];
int N, M;

void recurse(int R1, int C1, int R2, int C2, int num) {
	if (num == 0) {
		for (int i = R1; i <= R2; i ++) {
			for (int j = C1; j <= C2; j ++) {
				ar[i][j] = 0;
			}
		}

		return;
	} else if (num == (R2 - R1 + 1) * (C2 - C1 + 1)) {
		for (int i = R1; i <= R2; i ++) {
			for (int j = C1; j <= C2; j ++) {
				ar[i][j] = 1;
			}
		}

		return;
	}

	int r_divide = (R1 + R2) / 2;
	int c_divide = (C1 + C2) / 2;

	int b1 = countTreasure(R1 + 1, C1 + 1, r_divide + 1, c_divide + 1);
	int b2 = countTreasure(R1 + 1, c_divide + 2, r_divide + 1, C2 + 1);
	int b3 = countTreasure(r_divide + 2, C1 + 1, R2 + 1, c_divide + 1);

	recurse(R1, C1, r_divide, c_divide, b1);
	recurse(R1, c_divide + 1, r_divide, C2, b2);
	recurse(r_divide + 1, C1, R2, c_divide, b3);
	recurse(r_divide + 1, c_divide + 1, R2, C2, num - b1 - b2 - b3);
}

void findTreasure (int N) {
	int x = countTreasure(1, 1, N, N);
	recurse(0, 0, N - 1, N - 1, x);

	for (int i = 0; i < N; i ++) {
		for (int j = 0; j < N; j ++) {
			if (ar[i][j])
				Report(i + 1, j + 1);
		}
	}	
	
	return;	
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 4, r2 = 1, c2 = 3
2 Incorrect 4 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 4, c1 = 1, r2 = 3, c2 = 1
3 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 7, c1 = 16, r2 = 7, c2 = 15
4 Correct 5 ms 384 KB Output is correct - N = 16, K = 21046, score = 10
5 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 8, r2 = 1, c2 = 7
6 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 4, r2 = 1, c2 = 3
7 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 4, r2 = 1, c2 = 3
8 Incorrect 4 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 7, c1 = 21, r2 = 7, c2 = 20
9 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 8, r2 = 1, c2 = 7
10 Incorrect 5 ms 384 KB Error - check the range of the parameters of countTreasure() : r1 = 1, c1 = 8, r2 = 1, c2 = 7