Submission #146439

#TimeUsernameProblemLanguageResultExecution timeMemory
146439achibasadzishviliArt Class (IOI13_artclass)C++14
65 / 100
87 ms6136 KiB
#include<bits/stdc++.h>
#include "artclass.h"
#define ll long long
#define f first
#define s second
#define pb push_back
using namespace std;
long long pp = 0;
int style(int n,int m,int r[500][500],int g[500][500],int b[500][500]){
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            for(int x=-1; x<=1; x++)
                for(int y=-1; y<=1; y++)
                    if(i + x >= 0 && i + x < n && j + y >= 0 && j + y < m){
                        pp += abs(r[i][j] - r[i + x][j + y]) * abs(g[i][j] - g[i + x][j + y]) *
                        abs(b[i][j] - b[i + x][j + y]);
                    }
    // style 1 = 70726740182
    // style 2 = 20327879800
    // style 3 = 204620797406
    // style 4 = 476357764
    vector<ll>v;
    v.pb(70726740182);
    v.pb(20327879800);
    v.pb(204620797406);
    v.pb(476357764);
    ll mn = 100000000000000;
    int ret;
    for(int i=0; i<v.size(); i++){
        if(abs(v[i] - pp) < mn){
            mn = abs(v[i] - pp);
            ret = i + 1;
        }
    }
    return ret;
}
/*
int main(){
    cin >> n >> m;
    
    for(int i=0; i<n; i++)
        for(int j=0; j<m; j++)
            cin >> r[i][j] >> g[i][j] >> b[i][j];
    
    style();
    
    
    
    return 0;
}
*/

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:29:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<v.size(); i++){
                  ~^~~~~~~~~
artclass.cpp:35:12: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return ret;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...