Submission #405088

#TimeUsernameProblemLanguageResultExecution timeMemory
405088PedroBigManArt Class (IOI13_artclass)C++14
100 / 100
95 ms11156 KiB
#include "artclass.h"
/*
Author of all code: Pedro BIGMAN Dias
Last edit: 15/02/2021
*/
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma GCC optimize("Ofast")
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <iomanip>
#include <stdlib.h>
#include <time.h>
#include <cstring>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define whole(x) x.begin(),x.end()
#define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl
#define INF 500000000LL
#define EPS 0.00000001
#define pi 3.14159
ll mod=1000000007LL;
 
template<class A=ll> 
void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;}
 
template<class A=ll>
void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}}
 
int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) 
{
	cout.precision(20);
	ll H = (ll) h; ll W = (ll) w;
	vector<ll> xx; vector<vector<ll> > R,G,B; REP(i,0,W) {xx.pb(-1);} REP(i,0,H) {R.pb(xx); G.pb(xx); B.pb(xx);}
	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 white=0LL;
	REP(i,0,H)
	{
		REP(j,0,W)
		{
			if(R[i][j]>=200 && G[i][j]>=200 && B[i][j]>=200) {white++;}
		}
	}
	ld indwhite = (ld) white/(ld) (H*W); indwhite*=100.0;
	ll dist = 0LL;
	REP(i,0,H)
	{
		REP(j,0,W-1) {dist+=abs(R[i][j+1]-R[i][j]); dist+=abs(G[i][j+1]-G[i][j]); dist+=abs(B[i][j+1]-B[i][j]);}
	}
	REP(i,0,H-1) 
	{
		REP(j,0,W) {dist+=abs(R[i+1][j]-R[i][j]); dist+=abs(G[i+1][j]-G[i][j]); dist+=abs(B[i+1][j]-B[i][j]);}
	}
	ld indrand = (ld) dist/(ld) (H*W); indrand/=10.0;
	if(indrand<=2.0) {return 4;}
	if(indrand>=10.5) {return 3;}
	if(indwhite>=12.0) {return 1;}
	else {return 2;}
}

Compilation message (stderr)

artclass.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("O3")
      | 
artclass.cpp:7: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    7 | #pragma GCC optimization ("unroll-loops")
      |
#Verdict Execution timeMemoryGrader output
Fetching results...