Submission #1136463

#TimeUsernameProblemLanguageResultExecution timeMemory
1136463mychecksedadArt Class (IOI13_artclass)C++20
45 / 100
48 ms3348 KiB
#include "artclass.h" #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD1 (1000000000+7) #define MOD (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' #define ff first #define ss second #define pii pair<int,int> #define vi vector<int> const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30; int arr[4][2] = { {0, 1}, {1, 0}, {-1, 0}, {0, -1} }; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { ll red = 0, blue = 0, green = 0, white = 0, black = 0; for(int i = 0; i < 500; ++i) for(int j = 0; j < 500; ++j) red += R[i][j]; for(int i = 0; i < 500; ++i) for(int j = 0; j < 500; ++j) green += G[i][j]; for(int i = 0; i < 500; ++i) for(int j = 0; j < 500; ++j) blue += B[i][j]; for(int i = 0; i < 500; ++i) for(int j = 0; j < 500; ++j) white += (B[i][j] >= 100 && G[i][j] >= 100 && R[i][j] >= 100); for(int i = 0; i < 500; ++i) for(int j = 0; j < 500; ++j) black += (B[i][j] <= 20 && G[i][j] <= 20 && R[i][j] <= 20); // ll s = red + blue + green; int coef = 0, row_equality = 0; for(int i = 0; i < 500; ++i){ for(int j = 0; j < 500; ++j){ for(int k = 0; k < 4; ++k){ int nx = i + arr[k][0]; int ny = j + arr[k][1]; if(nx >= 0 && ny >= 0 && nx < 500 && ny < 500){ int dif = abs(R[i][j]-R[nx][ny]) + abs(G[i][j] - G[nx][ny]) + abs(B[i][j] - B[nx][ny]); if(dif < 20) coef++; if(dif < 40){ if(k >= 1 && k <= 2) row_equality++; } } } } } if(row_equality > 500*500*100/51) return 4; if(white > 500*500 / 3 && coef > 500*500*2) return 1; if(red > blue && green > blue && coef > 500*500*7/5 && black > 20000){ return 2; } // cout << black << ' '; // cout << red << ' ' << blue << ' ' << green << ' ' << s << ' ' << 500*500*3*150 << '\n'; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...