Submission #411223

#TimeUsernameProblemLanguageResultExecution timeMemory
411223faresbasbsArt Class (IOI13_artclass)C++14
49 / 100
87 ms3316 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; 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]; if(f >= 600){ p += 1; } if(f <= 100){ p2 += 1; } } } 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(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; } } }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:67:1: warning: control reaches end of non-void function [-Wreturn-type]
   67 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...