제출 #426558

#제출 시각아이디문제언어결과실행 시간메모리
426558Aldas25미술 수업 (IOI13_artclass)C++14
6 / 100
88 ms7152 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; #define FOR(i, a, b) for (int i = (a); i <= (b); i++) #define REP(n) FOR(O, 1, (n)) #define f first #define s second #define pb push_back typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<pii> vii; typedef long long ll; typedef vector<ll> vl; typedef long double ld; int id (int i, int j) { return i * 510 + j; } int par[520*520], sz[520*520]; int find (int a) {return par[a] = par[a]==a ? a : find(par[a]);} bool same (int a, int b) {return find(a) == find(b);} void unite (int a, int b) { a = find(a); b = find(b); if (a == b) return; par[b] = a; sz[a] += sz[b]; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { ll sumR = 0, sumG = 0, sumB = 0; FOR(i, 0, H-1) FOR(j, 0, W-1) { sumR += R[i][j]; sumG += G[i][j]; sumB += B[i][j]; par[id(i,j)] = id(i,j); sz[id(i,j)] = 1; } //cout << " sumR = " << sumR << " sumG = " << sumG << " sumB = " << sumB << endl; ll area = ((ll)H)*((ll)W); ld avR = ((ld)sumR) / ((ld)area); ld avG = ((ld)sumG) / ((ld)area); ld avB = ((ld)sumB) / ((ld)area); //cout << fixed << setprecision(3) << " avR = " << avR << " avG = " << avG << " avB = " << avB << endl; int ans = 1; if (avB < min(avR, avG) - 25.0) ans =2; else { if (max(avR, avG) < 150.0) ans = 4; } //cout << " ans = " << ans << endl; return ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...