Submission #146445

#TimeUsernameProblemLanguageResultExecution timeMemory
146445achibasadzishviliArt Class (IOI13_artclass)C++14
100 / 100
91 ms6140 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 n;int m;int r[500][500];int g[500][500];int b[500][500],af; 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){ af += g[i][j] - r[i][j] - b[i][j]; 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 if(pp < 10000000000)return 4; if(pp > 100000000000)return 3; // -336086706 -143795040 -384767008 -339261760 // -92720033 -126623263 -158012475 -186706437 if(af >= -200000000)return 2; return 1; vector<ll>v; v.pb(70726740182); v.pb(20327879800); 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; } } //cout << af << endl; } /* int main(){ ifstream cin("style-2-1.txt"); 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:35:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<v.size(); i++){
                  ~^~~~~~~~~
artclass.cpp:34:9: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
     int ret;
         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...