Submission #764288

#TimeUsernameProblemLanguageResultExecution timeMemory
764288fatemetmhrArt Class (IOI13_artclass)C++17
96 / 100
90 ms9268 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; #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]; set <ll> av; 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; 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; */ ll val = r[i][j] * valr + b[i][j] * valb + g[i][j] * valg; av.insert(val); if(i) sumdiff += abs(r[i][j] - r[i - 1][j]) + abs(g[i][j] - g[i - 1][j]) + abs(b[i][j] - b[i - 1][j]); if(i + 1 < h) sumdiff += abs(r[i][j] - r[i + 1][j]) + abs(g[i][j] - g[i + 1][j]) + abs(b[i][j] - b[i + 1][j]); if(j) sumdiff += abs(r[i][j] - r[i][j - 1]) + abs(g[i][j] - g[i][j - 1]) + abs(b[i][j] - b[i][j - 1]); if(j + 1 < w) sumdiff += abs(r[i][j] - r[i][j + 1]) + abs(g[i][j] - g[i][j + 1]) + abs(b[i][j] - b[i][j + 1]); } sumdiff /= 4 * h * w; //cout << sumdiff / (h * w * 2) << endl; if(sumdiff < 9) return 4; if(sumdiff >= 50) return 3; if(sumdiff <= 24) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...