Submission #801917

#TimeUsernameProblemLanguageResultExecution timeMemory
801917PixelCatArt Class (IOI13_artclass)C++14
100 / 100
51 ms4112 KiB
#include "artclass.h" #include <bits/stdc++.h> #define For(i, a, b) for(int i = a; i <= b; i++) using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { long long tot = 0; long long sr = 0; long long sg = 0; long long sb = 0; long long cg = 0; For(i, 0, H - 1) For(j, 0, W - 1) { sr += R[i][j]; sg += G[i][j]; sb += B[i][j]; cg += max(0, G[i][j] - max(R[i][j], B[i][j])); if(i) { tot += abs(R[i][j] - R[i - 1][j]); tot += abs(G[i][j] - G[i - 1][j]); tot += abs(B[i][j] - B[i - 1][j]); } if(j) { tot += abs(R[i][j] - R[i][j - 1]); tot += abs(G[i][j] - G[i][j - 1]); tot += abs(B[i][j] - B[i][j - 1]); } if(i && j) { tot += abs(R[i][j] - R[i - 1][j - 1]); tot += abs(G[i][j] - G[i - 1][j - 1]); tot += abs(B[i][j] - B[i - 1][j - 1]); } if(i < H - 1 && j) { tot += abs(R[i][j] - R[i + 1][j - 1]); tot += abs(G[i][j] - G[i + 1][j - 1]); tot += abs(B[i][j] - B[i + 1][j - 1]); } } long long hw = H * W; tot = (tot * 250000) / hw; sr = (sr * 250000) / hw; sg = (sg * 250000) / hw; sb = (sb * 250000) / hw; cg = (cg * 250000) / hw; #ifdef NYAOWO fstream fs; fs.open("./solver_output.txt", ios::out); fs << tot << "\n"; fs << sr << "\n"; fs << sg << "\n"; fs << sb << "\n"; fs << cg << "\n"; fs.close(); #endif if(tot < 10000000) return 4; if(tot > 60000000) return 3; long long a[] = {sr, sg, sb}; sort(a, a + 3); if(a[1] < 30000000) return 2; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...