제출 #411231

#제출 시각아이디문제언어결과실행 시간메모리
411231faresbasbs미술 수업 (IOI13_artclass)C++14
47 / 100
112 ms9268 KiB
#include <bits/stdc++.h> #include "artclass.h" using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { long long sum = 0 , diff = 0 , sum1 = 0 , sum2 = 0 , sum3 = 0 , mx = 0 , mn = 100000000 , p = 0 , p2 = 0; long long med1 , med2 , med3; vector<long long> all1,all2,all3; for(int i = 0 ; i < H ; i += 1){ for(int j = 0 ; j < W ; j += 1){ long long f = R[i][j]+G[i][j]+B[i][j]; mn = min(mn,f); mx = max(mx,f); sum1 += R[i][j]; sum2 += G[i][j]; sum3 += B[i][j]; all1.push_back(R[i][j]),all2.push_back(G[i][j]),all3.push_back(B[i][j]); if(f >= 600){ p += 1; } if(f <= 100){ p2 += 1; } } } sort(all1.begin(),all1.end()),sort(all2.begin(),all2.end()),sort(all3.begin(),all3.end()); med1 = all1[all1.size()/2] , med2 = all2[all2.size()/2] , med3 = all3[all3.size()/2]; long long mdv = max({med1,med2,med3})-min({med1,med2,med3}); for(int i = 0 ; i < H ; i += 1){ for(int j = 0 ; j < W ; j += 1){ long long f = R[i][j]+G[i][j]+B[i][j]; mn = min(mn,f); mx = max(mx,f); if(f >= mx-100){ p += 1; } if(f <= mn+100){ p2 += 1; } } } sum = sum1+sum2+sum3 , diff = max({sum1,sum2,sum3})-min({sum1,sum2,sum3}); // cout << sum1 << " " << sum2 << " " << sum3 << endl; // cout << " - " << (sum+diff)/2 << endl; // cout << mn << " " << mx << " " << p << " " << p2 << endl; int cnt[5]; memset(cnt,0,sizeof cnt); if(sum >= 100000000){ cnt[1] += 1; } if(sum2 >= 40000000){ cnt[1] += 1; } if(sum1 >= 40000000){ cnt[1] += 1; } if(med3 < 190){ cnt[2] += 1 , cnt[3] += 1 , cnt[4] += 1; } if(mdv > 80){ cnt[4] += 1; } if(p >= 150000){ cnt[1] += 1; } if(mx-mn <= 600){ cnt[4] += 1; } if(mn >= 40){ cnt[4] += 1; } if(diff >= 5000000 && diff <= 15000000){ cnt[2] += 1; } if(diff <= 5000000){ cnt[3] += 1; } long long maxi = max({cnt[1],cnt[2],cnt[3],cnt[4]}); // cout << maxi << " " << cnt[4] << endl; for(int i = 4 ; i >= 1 ; i -= 1){ if(cnt[i] == maxi){ return i; } } }

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

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:8:20: warning: control reaches end of non-void function [-Wreturn-type]
    8 |  vector<long long> all1,all2,all3;
      |                    ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...