Submission #285868

#TimeUsernameProblemLanguageResultExecution timeMemory
285868AMO5Art Class (IOI13_artclass)C++17
Compilation error
0 ms0 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define eb emplace_back #define all(x) x.begin(),x.end() #define sz(x) int(x.size()) #define maxn 505 using ii = pair<int,int>; /* style 1, cc * style 4, cc (blur) * style 2, mostly green * style 3, complicated */ int h,w; int c[mxn][mxn][3]; int dif(int x, int y, int x2, int y2){ int sum = 0; for(int k:{0,1,2}){ sum+=abs(c[x][y][k]-c[x2][y2][k]); } return sum; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]){ h=H,w=W; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ c[i][j][0]=R[i][j]; c[i][j][1]=G[i][j]; c[i][j][2]=B[i][j]; } } int sum=0,cnt=0; for(int i=0; i<h; i++){ for(int j=0; j<w; j++){ if(i)sum+=dif(i,j,i-1,j),cnt++; if(j)sum+=dif(i,j,i,j-1),cnt++; if(i+1<h)sum+=dif(i,j,i+1,j),cnt++; if(j+1<w)sum+=dif(i,j,i,j+1),cnt++; } } sum/=cnt; if(sum>=55)return 3; if(sum>=25)return 2; if(sum>=10)return 1; return 4; } /* int main() { return 0; } // */

Compilation message (stderr)

artclass.cpp:22:7: error: 'mxn' was not declared in this scope; did you mean 'maxn'?
   22 | int c[mxn][mxn][3];
      |       ^~~
      |       maxn
artclass.cpp:22:12: error: 'mxn' was not declared in this scope; did you mean 'maxn'?
   22 | int c[mxn][mxn][3];
      |            ^~~
      |            maxn
artclass.cpp: In function 'int dif(int, int, int, int)':
artclass.cpp:27:12: error: 'c' was not declared in this scope
   27 |   sum+=abs(c[x][y][k]-c[x2][y2][k]);
      |            ^
artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:36:4: error: 'c' was not declared in this scope
   36 |    c[i][j][0]=R[i][j];
      |    ^