# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
940723 | shenfe1 | Art Class (IOI13_artclass) | C++17 | 44 ms | 3656 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#pragma optimize("Ofast")
#pragma target("avx2")
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
// #define int ll
const int MAX=500+15;
const ll inf=1e9;
const int mod=1e9+7;
const int mod1=1e9+9;
const ld eps=1e-9;
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
int binpow(int a,int n){
if(!n)return 1;
if(n%2==1)return a*binpow(a,n-1);
int k=binpow(a,n/2);
return k*k;
}
#include "artclass.h"
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
ld sum=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(i)sum+=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)sum+=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(i&&j)sum+=abs(R[i][j]-R[i-1][j-1])+abs(G[i][j]-G[i-1][j-1])+abs(B[i][j]-B[i-1][j-1]);
}
}
sum/=(W*(H-1)+H*(W-1));
// cout<<sum<<"\n";
if(sum<=51)return 4;
if(sum>=188)return 3;
sum=0;
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
sum+=R[i][j]+G[i][j]+B[i][j];
}
}
sum/=H*W;
// cout<<sum<<"\n";
if(sum<=334)return 2;
return 1;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |