Submission #724170

#TimeUsernameProblemLanguageResultExecution timeMemory
724170Urvuk3Art Class (IOI13_artclass)C++17
29 / 100
78 ms4500 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; #define ll long long const int INF=1e9; const ll LINF=1e18; #define fi first #define se second #define pii pair<int,int> #define mid ((l+r)/2) #define sz(a) (int((a).size())) #define all(a) a.begin(),a.end() #define endl "\n" #define pb push_back void PRINT(int x) {cerr << x;} void PRINT(ll x) {cerr << x;} void PRINT(double x) {cerr << x;} void PRINT(char x) {cerr << '\'' << x << '\'';} void PRINT(string x) {cerr << '\"' << x << '\"';} void PRINT(bool x) {cerr << (x ? "true" : "false");} template<typename T,typename V> void PRINT(pair<T,V>& x){ cerr<<"{"; PRINT(x.fi); cerr<<","; PRINT(x.se); cerr<<"}"; } template<typename T> void PRINT(T &x){ int id=0; cerr<<"{"; for(auto _i:x){ cerr<<(id++ ? "," : ""); PRINT(_i); } cerr<<"}"; } void _PRINT(){ cerr<<"]\n"; } template<typename Head,typename... Tail> void _PRINT(Head h,Tail... t){ PRINT(h); if(sizeof...(t)) cerr<<", "; _PRINT(t...); } #define Debug(x...) cerr<<"["<<#x<<"]=["; _PRINT(x) bool Valid(int i,int j){ return (0<=i && i<500) && (0<=j && j<500); } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { vector<int> di={-1,1}; vector<int> dj={0,0}; ll difRv=0,difGv=0,difBv=0; for(int i=0;i<500;i++){ for(int j=0;j<500;j++){ for(int d=0;d<2;d++){ int i1=i+di[d]; int j1=j+dj[d]; if(Valid(i1,j1)){ difRv+=abs(R[i][j]-R[i1][j1]); difGv+=abs(G[i][j]-G[i1][j1]); difBv+=abs(B[i][j]-B[i1][j1]); } } } } di={0,0}; dj={-1,1}; ll difRh=0,difGh=0,difBh=0; for(int i=0;i<500;i++){ for(int j=0;j<500;j++){ for(int d=0;d<2;d++){ int i1=i+di[d]; int j1=j+dj[d]; if(Valid(i1,j1)){ difRh+=abs(R[i][j]-R[i1][j1]); difGh+=abs(G[i][j]-G[i1][j1]); difBh+=abs(B[i][j]-B[i1][j1]); } } } } di={-1,0,1,0}; dj={0,1,0,-1}; ll similar=0; ll disimilar=0; for(int i=0;i<500;i++){ for(int j=0;j<500;j++){ for(int d=0;d<4;d++){ int i1=i+di[d]; int j1=j+dj[d]; ll dif=0; if(Valid(i1,j1)){ dif+=abs(R[i][j]-R[i1][j1]); dif+=abs(G[i][j]-G[i1][j1]); dif+=abs(B[i][j]-B[i1][j1]); if(dif<=1) similar++; if(dif>=300) disimilar++; } } } } vector<ll> ret={difRv,difGv,difBv,difRh,difGh,difBh,similar,disimilar}; if(difRv>=9e6 && difGv>=9e6 && difBv>=9e6){ return 3; } else if(difRh<=39e5 && difGh<=39e5 && difBh<=39e5){ return 4; } else{ return 2; } }
#Verdict Execution timeMemoryGrader output
Fetching results...