Submission #1136475

#TimeUsernameProblemLanguageResultExecution timeMemory
1136475mychecksedadArt Class (IOI13_artclass)C++20
81 / 100
39 ms3400 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]) { int li = -1, ri = 500, lj = -1, rj = 500; for(int i = 0; i < 500; ++i){ for(int j = 0; j < 500; ++j){ if(R[i][j] + G[i][j] + B[i][j] > 0){ li = i; break; } } if(li != -1) break; } for(int j = 0; j < 500; ++j){ for(int i = 0; i < 500; ++i){ if(R[i][j] + G[i][j] + B[i][j] > 0){ lj = j; break; } } if(lj != -1) break; } for(int i = 499; i >= 0; --i){ for(int j = 0; j < 500; ++j){ if(R[i][j] + G[i][j] + B[i][j] > 0){ ri = i; break; } } if(ri < 500) break; } for(int j = 499; j >= 0; --j){ for(int i = 0; i < 500; ++i){ if(R[i][j] + G[i][j] + B[i][j] > 0){ rj = j; break; } } if(rj < 500) break; } ll red = 0, blue = 0, green = 0, white = 0, black = 0; for(int i = li; i <= ri; ++i) for(int j = lj; j <= rj; ++j) red += R[i][j]; for(int i = li; i <= ri; ++i) for(int j = lj; j <= rj; ++j) green += G[i][j]; for(int i = li; i <= ri; ++i) for(int j = lj; j <= rj; ++j) blue += B[i][j]; for(int i = li; i <= ri; ++i) for(int j = lj; j <= rj; ++j) white += (B[i][j] >= 100 && G[i][j] >= 100 && R[i][j] >= 100); for(int i = li; i <= ri; ++i) for(int j = lj; j <= rj; ++j) black += (B[i][j] + R[i][j] + B[i][j] <= 20); // ll s = red + blue + green; int coef = 0, row_equality = 0; for(int i = li; i <= ri; ++i){ for(int j = lj; j <= rj; ++j){ for(int k = 0; k < 4; ++k){ int nx = i + arr[k][0]; int ny = j + arr[k][1]; if(nx >= li && ny >= lj && nx <= ri && ny <= rj){ 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++; } } } } } int tot = (ri-li+1)*(rj-lj+1); if(row_equality > tot*100/51) return 4; if(white > tot / 3 && coef > tot*2) return 1; if(red + green > blue*2 && coef > tot && black <= 6000){ return 2; } // cout << red << ' ' << blue << ' ' << green << ' ' << s << ' ' << 500*500*3*150 << '\n'; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...