Submission #154263

#TimeUsernameProblemLanguageResultExecution timeMemory
154263Breno_XDTreasure (different grader from official contest) (CEOI13_treasure2)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "treasure.h" using namespace std; int n; int quarter(int r, int c){ //Primeiro quadrante -> célula (1,n) int primeiro = r * (abs(n - c) +1); //Segundo quadrante -> célula (1,1); int segundo = r * c; //Terceiro quadrante -> célula(n,1); int terceiro = (abs(n - r) + 1) * c; //Quarto quadrante -> célula (n,n) int quarto = (abs(n-r) + 1) * (abs(n-c) + 1); int ans = max(primeiro, max(segundo, max(terceiro, quarto))); if(ans == primeiro) return 1; if(ans == segundo) return 2; if(ans == terceiro) return 3; if(ans == quarto) return 4; } void findTreasure(int N){ n = N; int pre[n+1][n+1]; memset(resp, 0, sizeof(resp)); memset(pre, 0, sizeof(pre)); for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(quarter(i,j) == 1){ pref[i][j] = pre[i][n] - countTreasure(1,j+1,i,n); }else if(quarter(i,j) == 2){ pre[i][j] = countTreasure(1,1, i,j); }else if(quarter(i,j) == 3){ pre[i][j] = pre[n][j] - countTreasure(i+1, 1, n, j); }else{ pre[i][j] = -pre[n][n] + pre[i][n] + pre[n][j] + countTreasure(i+1, j+1, n, n); } } } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(pre[i][j] - pre[i-1][j] - pre[i][j-1] + pre[i-1][j-1] == 1) Report(i, j); } } return; }

Compilation message (stderr)

treasure.cpp: In function 'void findTreasure(int)':
treasure.cpp:34:9: error: 'resp' was not declared in this scope
  memset(resp, 0, sizeof(resp));
         ^~~~
treasure.cpp:34:9: note: suggested alternative: 'frexp'
  memset(resp, 0, sizeof(resp));
         ^~~~
         frexp
treasure.cpp:42:5: error: 'pref' was not declared in this scope
     pref[i][j] = pre[i][n] - countTreasure(1,j+1,i,n);
     ^~~~
treasure.cpp:42:5: note: suggested alternative: 'pre'
     pref[i][j] = pre[i][n] - countTreasure(1,j+1,i,n);
     ^~~~
     pre
treasure.cpp: In function 'int quarter(int, int)':
treasure.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^