Submission #55443

# Submission time Handle Problem Language Result Execution time Memory
55443 2018-07-07T13:29:17 Z gs18081 Treasure (different grader from official contest) (CEOI13_treasure2) C++11
10 / 100
2 ms 824 KB
#include "treasure.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> pi;
vector<pi> ans;
int find(int y1,int x1,int y2,int x2){
    int cnt=countTreasure(y1,x1,y2,x2);
    if(x1==x2){
        if(cnt==1){
            ans.push_back(pi(y1,x1));
        }
        return cnt;
    }
    int size=(x2-x1+1)*(x2-x1+1);
    int remain=cnt;
    int y3=(y1+y2)>>1;
    int x3=(x1+x2)>>1;
    int pos[4][4]={{y1,x1,y3,x3},{y1,x3+1,y3,x2},{y3+1,x1,y2,x3},{y3+1,x3+1,y2,x2}};
    for(int i=0;i<4;i++){
        int *now=pos[i];
        if(remain==size){
            for(int j=now[0];j<=now[2];j++){
                for(int k=now[1];k<=now[3];k++){
                    ans.push_back(pi(j,k));
                }
            }
            remain-=(now[2]-now[0]+1)*(now[3]-now[1]+1);
        }
        else if(remain==0) break;
        else{
            remain-=find(now[0],now[1],now[2],now[3]);
        }
        size-=(now[2]-now[0]+1)*(now[3]-now[1]+1);
    }
    return cnt;
}
void findTreasure (int N) {
    find(1,1,N,N);
    for(auto i:ans){
        Report(i.first,i.second);
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 376 KB Error - not all of the treasure cells have been reported
2 Incorrect 2 ms 376 KB Error - no treasure at (r, c) : r = 3, c = 4
3 Incorrect 2 ms 436 KB Error - no treasure at (r, c) : r = 7, c = 13
4 Correct 2 ms 440 KB Output is correct - N = 16, K = 20170, score = 10
5 Incorrect 2 ms 572 KB Error - no treasure at (r, c) : r = 1, c = 13
6 Incorrect 2 ms 656 KB Error - no treasure at (r, c) : r = 1, c = 4
7 Incorrect 2 ms 656 KB Error - no treasure at (r, c) : r = 1, c = 3
8 Incorrect 2 ms 744 KB Error - no treasure at (r, c) : r = 9, c = 21
9 Incorrect 2 ms 752 KB Error - no treasure at (r, c) : r = 3, c = 10
10 Incorrect 2 ms 824 KB Error - no treasure at (r, c) : r = 1, c = 7