Submission #61252

#TimeUsernameProblemLanguageResultExecution timeMemory
61252istleminArt Class (IOI13_artclass)C++14
40 / 100
140 ms9452 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i = a; i<int(b);++i) #define all(v) v.begin(),v.end() #define sz(v) v.size() #define trav(a,c) for(auto a: c) typedef long long ll; typedef vector<ll> vi; typedef pair<ll,ll> pii; ll h,w; vector<vi> r,g,b; ll sumDiff(ll dh,ll dw){ ll sum = 0; rep(i,0,h){ rep(j,0,w){ if(i+dh<h){ sum += abs(r[i][j]-r[i+dh][j]); sum += abs(g[i][j]-g[i+dh][j]); sum += abs(b[i][j]-b[i+dh][j]); } if(j+dw<w){ sum += abs(r[i][j]-r[i][j+dw]); sum += abs(g[i][j]-g[i][j+dw]); sum += abs(b[i][j]-b[i][j+dw]); } } } return sum; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { h = H; w = W; r.resize(h,vi(w)); g.resize(h,vi(w)); b.resize(h,vi(w)); rep(i,0,h) rep(j,0,w){ r[i][j] = R[i][j]; g[i][j] = G[i][j]; b[i][j] = B[i][j]; } ll sumD = sumDiff(5,5); if(sumD<12000000LL) return 4; if(sumD<40000000LL) return 1; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...