Submission #764332

#TimeUsernameProblemLanguageResultExecution timeMemory
764332fatemetmhrArt Class (IOI13_artclass)C++17
100 / 100
56 ms3340 KiB
// ~ Be Name Khoda ~ // #include "artclass.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,Ofast") using namespace std; typedef long long ll; typedef long double ld; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 1.2e6 + 10; const int maxn3 = 1e3 + 10; const int mod = 1e9 + 7; const ll inf = 1e18; int cnt[maxn5]; int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]){ ll valr = 256, valg = 256 * 256, valb = 1; ll sumdiff = 0; ld avg = 0; int sefid = 0; for(int i = 0; i < h; i++) for(int j = 0; j < w; j++){ /* r[i][j] /= 5; r[i][j] *= 5; b[i][j] /= 5; b[i][j] *= 5; g[i][j] /= 5; g[i][j] *= 5; */ int brt = r[i][j] + b[i][j] + g[i][j]; if(brt >= 700) sefid++; if(g[i][j] + r[i][j] + b[i][j]) avg += ld(g[i][j]) / (g[i][j] + r[i][j] + b[i][j]); if(i){ ll diff = abs(r[i][j] - r[i - 1][j]) + abs(g[i][j] - g[i - 1][j]) + abs(b[i][j] - b[i - 1][j]); cnt[diff / 100]++; sumdiff += diff; } if(i + 1 < h){ ll diff = abs(r[i][j] - r[i + 1][j]) + abs(g[i][j] - g[i + 1][j]) + abs(b[i][j] - b[i + 1][j]); cnt[diff / 100]++; sumdiff += diff; } if(j){ ll diff = abs(r[i][j] - r[i][j - 1]) + abs(g[i][j] - g[i][j - 1]) + abs(b[i][j] - b[i][j - 1]); cnt[diff / 100]++; sumdiff += diff; } if(j + 1 < w){ ll diff = abs(r[i][j] - r[i][j + 1]) + abs(g[i][j] - g[i][j + 1]) + abs(b[i][j] - b[i][j + 1]); cnt[diff / 100]++; sumdiff += diff; } } //cout << sefid << ' ' << ld(sefid) / (h * w) << endl; //cout << cnt[4] << ' ' << cnt[5] << endl; /* for(int i = 0; i < 10; i++) cout << cnt[i] << ' '; cout << endl; */ sumdiff /= 4 * h * w; avg /= h * w; //cout << avg << endl; //cout << sumdiff << endl; if(sumdiff < 9) return 4; if(sumdiff >= 60 || (sumdiff >= 50 && sefid >= 250)) return 3; if(cnt[4] >= 1000) return 1; if(avg >= 0.4) return 2; if(sumdiff <= 24) return 1; return 2; }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:32:8: warning: unused variable 'valr' [-Wunused-variable]
   32 |     ll valr = 256, valg = 256 * 256, valb = 1;
      |        ^~~~
artclass.cpp:32:20: warning: unused variable 'valg' [-Wunused-variable]
   32 |     ll valr = 256, valg = 256 * 256, valb = 1;
      |                    ^~~~
artclass.cpp:32:38: warning: unused variable 'valb' [-Wunused-variable]
   32 |     ll valr = 256, valg = 256 * 256, valb = 1;
      |                                      ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...