Submission #64551

#TimeUsernameProblemLanguageResultExecution timeMemory
64551TadijaSebezArt Class (IOI13_artclass)C++11
9 / 100
117 ms3580 KiB
#include "artclass.h"
#include <stdio.h>
const int N=500;
int abs(int x){ return x>0?x:-x;}
int style(int n, int m, int r[N][N], int g[N][N], int b[N][N])
{
	int i,j,green=0,yellow=0,gray=0,white=0;
	int sz=n*(m-1)+m*(n-1),dif=0;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m-1;j++)
		{
			dif+=abs(r[i][j]-r[i][j+1])+abs(g[i][j]-g[i][j+1])+abs(b[i][j]-b[i][j+1]);
		}
	}
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<m;j++)
		{
			dif+=abs(r[i][j]-r[i+1][j])+abs(g[i][j]-g[i+1][j])+abs(b[i][j]-b[i+1][j]);
		}
	}
	dif/=sz;
	if(dif<10) return 1;
	if(dif<25) return 4;
	if(dif<50) return 2;
	return 3;
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:7:10: warning: unused variable 'green' [-Wunused-variable]
  int i,j,green=0,yellow=0,gray=0,white=0;
          ^~~~~
artclass.cpp:7:18: warning: unused variable 'yellow' [-Wunused-variable]
  int i,j,green=0,yellow=0,gray=0,white=0;
                  ^~~~~~
artclass.cpp:7:27: warning: unused variable 'gray' [-Wunused-variable]
  int i,j,green=0,yellow=0,gray=0,white=0;
                           ^~~~
artclass.cpp:7:34: warning: unused variable 'white' [-Wunused-variable]
  int i,j,green=0,yellow=0,gray=0,white=0;
                                  ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...