Submission #789527

# Submission time Handle Problem Language Result Execution time Memory
789527 2023-07-21T13:12:15 Z AdamGS Art Class (IOI13_artclass) C++17
Compilation error
0 ms 0 KB
#include "artclass.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=507;
ll C[LIM][LIM][3], F[LIM*LIM], ile[LIM*LIM], dx[]={1, 0, -1, 0}, dy[]={0, 1, 0, -1}, n, m;
vector<ld>Z[LIM][LIM];
vector<ld>norm(int x, int y) {
	ll ma=1;
	rep(i, 3) ma=max(ma, C[x][y][i]);
	vector<ld>V;
	rep(i, 3) V.pb((ld)C[x][y][i]*(ld)255/(ld)ma);
	return V;
}
bool podobne(int x1, int y1, int x2, int y2) {
	vector<ld>A=norm(x1, y1), B=norm(x2, y2);
	ld sum=0;
	rep(i, 3) sum+=abs(A[i]-B[i]);
	return sum<=50;
}
bool ok(int a, int b) {
	return 0<=a && a<n && 0<=b && b<m;
}
int fnd(int x) {
	if(F[x]==x) return x;
	return F[x]=fnd(F[x]);
}
void uni(int x, int y) {
	if(fnd(x)==fnd(y)) return;
	ile[fnd(x)]+=ile[fnd(y)];
	F[fnd(y)]=fnd(x);
}
ld style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
	n=H; m=W;
	rep(i, n) rep(j, m) {
		C[i][j][0]=R[i][j];
		C[i][j][1]=G[i][j];
		C[i][j][2]=B[i][j];
		ile[i*m+j]=1;
		F[i*m+j]=i*m+j;
		Z[i][j]=norm(i, j);
	}
	ll sum=0;
	rep(i, n-9) rep(j, m-9) {
		vector<ld>mi=Z[i][j], ma=Z[i][j];
		rep(a, 10) rep(b, 10) {
			rep(c, 3) {
				mi[c]=min(mi[c], Z[i+a][j+b][c]);
				ma[c]=max(ma[c], Z[i+a][j+b][c]);
			}
		}
		int li=0;
		rep(a, 3) li+=ma[a]-mi[a];
		if(li<20) ++sum;
	}
	if((ld)sum/(ld)((n-9)*(m-9))>0.05) {
		sum=0;
		rep(i, n) rep(j, m) if(C[i][j][0]+C[i][j][1]+C[i][j][2]<100) ++sum;
		//rep(i, n) rep(j, m) if(C[i][j][0]>=200 && C[i][j][1]>=200 && C[i][j][2]>=200) ++sum;
		//return sum;
		if((ld)sum/(ld)((n-9)*(m-9))>0.1) return 1;
		return 4;
	}
	sum=0;
	rep(i, n) rep(j, m) rep(l, 4) if(ok(i+dx[l], j+dy[l]) && podobne(i, j, i+dx[l], j+dy[l])) ++sum;
	//return (ld)sum/(ld)(n*m);
	rep(i, n) rep(j, m) if(C[i][j][1]>2*max(C[i][j][0], C[i][j][2])) ++sum;
	if(sum>300) return 2;
	return 3;
}

Compilation message

artclass.cpp:39:4: error: ambiguating new declaration of 'ld style(int, int, int (*)[500], int (*)[500], int (*)[500])'
   39 | ld style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
      |    ^~~~~
In file included from artclass.cpp:1:
artclass.h:8:5: note: old declaration 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])'
    8 | int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]);
      |     ^~~~~