제출 #801871

#제출 시각아이디문제언어결과실행 시간메모리
801871PixelCatArt Class (IOI13_artclass)C++14
34 / 100
62 ms6032 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;
    For(i, 0, H - 1) For(j, 0, W - 1) {
        sr += R[i][j];
        sg += G[i][j];
        sb += 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]);
        }
    }
#ifdef NYAOWO
    fstream fs;
    fs.open("./solver_output.txt", ios::out);
    fs << tot << "\n";
    fs << sr << "\n";
    fs << sg << "\n";
    fs << sb << "\n";
    fs.close();
#endif
    if(tot < 10000000) return 4;
    if(tot > 30000000) return 3;
    return 2;
}
#Verdict Execution timeMemoryGrader output
Fetching results...