Submission #739681

#TimeUsernameProblemLanguageResultExecution timeMemory
739681yeysoArt Class (IOI13_artclass)C++14
0 / 100
57 ms6236 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; int style(int h, int w, int R[500][500], int G[500][500], int B[500][500]) { //return 2; vector<vector<int>> gr(h, vector<int>(w, 0)); vector<vector<int>> gg(h, vector<int>(w, 0)); vector<vector<int>> gb(h, vector<int>(w, 0)); vector<int> grd(500, 0); vector<int> grg(500, 0); vector<int> grb(500, 0); int mcir = 0; int mcig = 0; int mcib = 0; int noiser = 0; int noiseg = 0; int noiseb = 0; int productrgb = 1; int dr, dg, db; int white = 0; int black = 0; for(int i = 1; i < h; i ++){ for(int j = 1; j < w; j ++){ dr = 2 * R[i][j] - R[i-1][j] - R[i][j-1]; dg = 2 * G[i][j] - G[i-1][j] - G[i][j-1]; db = 2 * B[i][j] - B[i-1][j] - B[i][j-1]; if(R[i][j] > 200 and G[i][j] > 200 and B[i][j] > 200){ white += 1; } if(R[i][j] < 50 and G[i][j] < 50 and B[i][j] < 50){ black += 1; } gr[i][j] = dr; gg[i][j] = dg; gb[i][j] = db; grd[abs(dr)] += 1; grg[abs(dg)] += 1; grb[abs(db)] += 1; noiser += abs(dr); noiseg += abs(dg); noiseb += abs(db); } } noiser /= (h * w); noiseg /= (h * w); noiseb /= (h * w); vector<int> rfix = {0}; vector<int> gfix = {0}; vector<int> bfix = {0}; for(int i = 0; i < grd.size(); i ++){ rfix.push_back(rfix[rfix.size()-1] + grd[i]); gfix.push_back(gfix[gfix.size()-1] + grg[i]); bfix.push_back(rfix[bfix.size()-1] + grb[i]); } if(rfix[6] + gfix[6] + bfix[6] > 200000 * (h * w) / (500 * 500)){ if(white + black > 23000 * (h * w) / (500 * 500)){ return 1; } else { return 4; } } else { if(noiser + noiseg + noiseb > 100){ return 3; } else { return 2; } } } /* g++ -DEVAL -static -O2 -o artclass grader.c artclass.cpp */

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:55:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for(int i = 0; i < grd.size(); i ++){
      |                    ~~^~~~~~~~~~~~
artclass.cpp:15:9: warning: unused variable 'mcir' [-Wunused-variable]
   15 |     int mcir = 0;
      |         ^~~~
artclass.cpp:16:9: warning: unused variable 'mcig' [-Wunused-variable]
   16 |     int mcig = 0;
      |         ^~~~
artclass.cpp:17:9: warning: unused variable 'mcib' [-Wunused-variable]
   17 |     int mcib = 0;
      |         ^~~~
artclass.cpp:22:9: warning: unused variable 'productrgb' [-Wunused-variable]
   22 |     int productrgb = 1;
      |         ^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...