# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1027122 | vjudge1 | Aliens (IOI16_aliens) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "artclass.h"
#include<bits/stdc++.h>
using namespace std;
int percent_landscape(int H,int W,int R[500][500],int G[500][500],int B[500][500]){
int kindagreen=0,kindayellow=0;
for(int i=0;i<H;i++)
for(int j=0;j<W;j++) {
int disttoy=0;
disttoy=B[i][j];
disttoy=max(disttoy,abs(160-R[i][j]));
disttoy=max(disttoy,abs(130-G[i][j]));
if(G[i][j]>=160&&R[i][j]<=170&&B[i][j]<=100)
kindagreen++;
else if(G[i][j]>=100&&R[i][j]<=120&&B[i][j]<=70)
kindagreen++;
if(disttoy<=100)
kindayellow++;
}
return kindagreen+kindayellow>=H*W/5;
}
int percent_blk_wht(int H,int W,int R[500][500],int G[500][500],int B[500][500]){
int kindablk_wht =0;
for(int i=0;i<H;i++)
for(int j=0;j<W;j++) {
int K=min({R[i][j],G[i][j],B[i][j]});
int L=max({R[i][j],G[i][j],B[i][j]});
if(L<50||K>190)
kindablk_wht++;
}
return kindablk_wht>=H*W/2;
}
int randomscattered(int H,int W,int R[500][500],int G[500][500],int B[500][500]){
int whatde[26][26][26]{};
for(int i=0;i<H;i++)
for(int j=0;j<W;j++)
whatde[R[i][j]/10][G[i][j]/10][B[i][j]/10]++;
int hvsomet=0;
int cnt[25010]{};
for(auto&i:whatde)
for(auto &j:i) for(auto &k:i)
hvsomet+=!!k,cnt[(int)(k+99)/100]++;
if(hvsomet<=100) {
int k=*max_element(cnt,cnt+25010);
if(k>=30)
return 2;
}
return hvsomet<=10;
}
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
int k=randomscattered(H,W,R,G,B);
if(k==2)
return 3;
if(k==1)
return 4;
if(percent_blk_wht(H,W,R,G,B))
return 1;
return 2;
}