Submission #1174474

#TimeUsernameProblemLanguageResultExecution timeMemory
1174474LithaniumArt Class (IOI13_artclass)C++20
0 / 100
5099 ms8884 KiB
#include <bits/stdc++.h>
#include "artclass.h"
using namespace std;

int dt[505][505];

int getR(int RGB) { return (RGB >> 16) & 0xFF; }
int getG(int RGB) { return (RGB >> 8) & 0xFF; }
int getB(int RGB) { return RGB & 0xFF; }

int diff(int v1, int v2) {
    return abs(getR(v1) - getR(v2)) + abs(getG(v1) - getG(v2)) + abs(getB(v1) - getB(v2));
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double stuff = 0;
    for (int i = 1; i <= H; i ++) {
        for (int j = 1; j <= W; j ++) {
            dt[i][j] = ((R[i-1][j-1] << 8) + G[i-1][j-1]) << 8 + B[i-1][j-1];
            if (i > 1) stuff += diff(dt[i][j], dt[i-1][j]);
            if (j > 1) stuff += diff(dt[i][j], dt[i][j-1]);
        }
    }
    stuff /= (double)H*W - H - W + 1;
    if (stuff < 20) cout << "4\n";
    else if (stuff < 46) cout << "1\n";
    else if (stuff < 105) cout << "2\n";
    else cout << "3\n";
    // cout << test << ": " << stuff << "\n";
}

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:30:1: warning: no return statement in function returning non-void [-Wreturn-type]
   30 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...