제출 #383625

#제출 시각아이디문제언어결과실행 시간메모리
383625Keshi미술 수업 (IOI13_artclass)C++17
컴파일 에러
0 ms0 KiB
//In the name of God
#include <bits/stdc++.h>
#include <fstream>
using namespace std;

typedef int ll;
typedef pair<ll, ll> pll;

const ll maxn = 500;
const ll mod = 1e9 + 7;
const ll inf = 1e9;

#define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout);
#define pb push_back
#define Mp make_pair
#define F first
#define S second
#define Sz(x) ll((x).size())
#define all(x) (x).begin(), (x).end()

ll diff(ll r1, ll g1, ll b1, ll r2, ll g2, ll b2){
	return (abs(r1 - r2) + abs(g1 - g2) + abs(b1 - b2));
}

ll a[maxn * maxn];

ll val1(int h, int w, int r[500][500], int g[500][500], int b[500][500]){
    for(ll i = 1; i < h; i++){
		for(ll j = 1; j < w; j++){
			a[i * w + j] = diff(r[i][j], g[i][j], b[i][j], r[i - 1][j], g[i - 1][j], b[i - 1][j]);
		}
	}
	sort(a, a + (h - 1) * (w - 1));
	return a[(h - 1) * (w - 1) * 3 / 4];
}
long double val2(int h, int w, int r[500][500], int g[500][500], int b[500][500]){
	ll t = 0;
    for(ll i = 1; i < h; i++){
		for(ll j = 1; j < w; j++){
			if(diff(r[i][j], g[i][j], b[i][j], r[i - 1][j], g[i - 1][j], b[i - 1][j]) > 30 ||
			   diff(r[i][j], g[i][j], b[i][j], r[i][j - 1], g[i][j - 1], b[i][j - 1]) > 30){
				t++;
			}
		}
	}
	return (1.0 * t) / (1.0 * w * h) * 100;
}



int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) {
	ll x1 = val1(h, w, r, g, b);
	long double x2 = val2(h, w, r, g, b);
	if(x2 < 5) return 4;
	if(x1 > 75 || x2 > 75) return 3;
	if(x2 < 34) return 1;
	return 2;
}


/*int main(){
    //fast_io;

	ll h, w, r[maxn][maxn], g[maxn][maxn], b[maxn][maxn];
	for(char i = '1'; i <= '4'; i++){
		for(char j = '1'; j <= '9'; j++){
			string s = "images/style-";
			s += i;
			s += "/style-";
			s += i;
			s += "-";
			s += j;
			s += ".txt";
			ifstream mf(s);
			mf >> h >> w;
			for(ll x = 0; x < h; x++){
				for(ll y = 0; y < w; y++){
					mf >> r[x][y] >> g[x][y] >> b[x][y];
				}
			}
			cout << i << '-' << j << " -> " << style(h, w, r, g, b) << "\n";//val1(h, w, r, g, b) << " " << val2(h, w, r, g, b) << "\n";
		}
		cout << "------------\n";
	}

    return 0;
}*/

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccBKayIX.o: In function `main':
grader.c:(.text.startup+0x213): undefined reference to `style'
collect2: error: ld returned 1 exit status