Submission #257717

#TimeUsernameProblemLanguageResultExecution timeMemory
257717davi_bartArt Class (IOI13_artclass)C++14
93 / 100
92 ms20472 KiB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;
typedef long long ll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int e=20;
bool vis[260][260][260];
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]){
    for(int i=0;i<259;i++){
      for(int j=0;j<259;j++){
        for(int h=0;h<259;h++)vis[i][j][h]=0;
      }
    }
    int r=0,g=0,b=0;
    int diff=0,tot=0;
    int neri=0;
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
        r+=R[i][j];
        g+=G[i][j];
        b+=B[i][j];
        if(i>0){
          tot++;
          if(abs(R[i][j]-R[i-1][j])+abs(G[i][j]-G[i-1][j])+abs(B[i][j]-B[i-1][j])>e)diff++;
        }
        if(j>0){
          tot++;
          if(abs(R[i][j]-R[i][j-1])+abs(G[i][j]-G[i][j-1])+abs(B[i][j]-B[i][j-1])>e)diff++;
        }
        //if(R[i][j]+G[i][j]+B[i][j]<20)neri++;
        vis[R[i][j]][G[i][j]][B[i][j]]=1;
      }
    }
    int num=0;
    for(int i=0;i<259;i++){
      for(int j=0;j<259;j++){
        for(int h=0;h<259;h++)num+=vis[i][j][h];
      }
    }
    int x=diff*100.0/tot;
    //cout<<r/(H*W)<<" "<<g/(H*W)<<" "<<b/(H*W)<<endl;
    //cout<<x<<"%  div:"<<num<<"    ";
    if(x<5)return 4;
    if(x<35)return 1;
    if(x<60 || (x<75 && (b/(H*W)<80)))return 2;
    return 3;
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:17:9: warning: unused variable 'neri' [-Wunused-variable]
     int neri=0;
         ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...