제출 #123123

#제출 시각아이디문제언어결과실행 시간메모리
123123Mahdi_Jfri미술 수업 (IOI13_artclass)C++14
8 / 100
245 ms16308 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 5e2 + 20; const int dx[] = {0 , 0 , -1 , 1}; const int dy[] = {1 ,-1 , 0 , 0}; int style(int n , int m , int R[500][500] , int G[500][500] , int B[500][500]) { vector<int> tmp1 , tmp2 , tmp3; int mR = 0; for(int x = 0; x < n; x++) for(int y = 0; y < m; y++) { mR += R[x][y]; for(int i = 0; i < 4; i++) { int nx = x + dx[i] , ny = y + dy[i]; if(0 <= nx && nx < n && 0 <= ny && ny < m) { tmp1.pb(abs(R[x][y] - R[nx][ny])); tmp2.pb(abs(G[x][y] - G[nx][ny])); tmp3.pb(abs(B[x][y] - B[nx][ny])); } } } sort(tmp1.begin() , tmp1.end()); sort(tmp2.begin() , tmp2.end()); sort(tmp3.begin() , tmp3.end()); tmp1.erase(tmp1.begin() , tmp1.begin() + 5000); tmp2.erase(tmp2.begin() , tmp2.begin() + 5000); tmp3.erase(tmp3.begin() , tmp3.begin() + 5000); int sum1 = 0 , sum2 = 0 , sum3 = 0 , sz = tmp1.size(); for(int i = 0; i < (int)tmp1.size(); i++) { sum1 += tmp1[i]; sum2 += tmp2[i]; sum3 += tmp3[i]; } sum1 += sum2 + sum3; sz *= 3; if(sum1 / (double)sz <= 12) return 4; if(sum1 / (double)sz <= 35) return 2; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...