Submission #154238

#TimeUsernameProblemLanguageResultExecution timeMemory
154238Breno_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 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; int resp[n+1][n+1]; int pref[n+1][n+1]; memset(resp, 0, sizeof(resp)); memset(pref, 0, sizeof(pref)); for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(quarter(i,j) == 1){ resp[i][j] = countTreasure(i,j,1,n) - countTreasure(i,j,1,n-1) - countTreasure(i,j,2,n) + countTreasure(i,j,2,n-1); }else if(quarter(i,j) == 2){ resp[i][j] = countTreasure(i,1,1,j) - countTreasure(i,1,1,j-1) - countTreasure(i,1,2,j) + countTreasure(i,1,2,j-1); }else if(quarter(i,j) == 3){ resp[i][j] = countTreasure(n,1,i,j) - countTreasure(n,1,i+1,j) - countTreasure(n,1,i,j-1) + countTreasure(n,1,i+1,j-1); }else{ resp[i][j] = countTreasure(n,j,i,n) - countTreasure(n,j,i+1,n) - countTreasure(n,j,i,n-1) + countTreasure(n,j,i+1,n-1); } } } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ cout << resp[i][j]; } cout << "\n"; } return; }

Compilation message (stderr)

treasure.cpp:2:22: warning: extra tokens at end of #include directive
 #include "treasure.h";
                      ^
treasure.cpp: In function 'int quarter(int, int)':
treasure.cpp:8:26: error: 'n' was not declared in this scope
  int primeiro = r * (abs(n - c) +1);
                          ^
treasure.cpp: In function 'void findTreasure()':
treasure.cpp:30:10: error: 'N' was not declared in this scope
  int n = N;
          ^
treasure.cpp: In function 'int quarter(int, int)':
treasure.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^