Submission #155864

#TimeUsernameProblemLanguageResultExecution timeMemory
155864TAISA_Art Class (IOI13_artclass)C++14
12 / 100
81 ms6312 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int r[500][500], g[500][500], b[500][500]; ll check(int y, int x) { ll sr = pow(r[y][x + 1] - r[y][x], 2) + pow(r[y + 1][x + 1] - r[y][x], 2) + pow(r[y + 1][x] - r[y][x], 2) + pow(r[y + 1][x + 1] - r[y + 1][x], 2); ll sg = pow(g[y][x + 1] - g[y][x], 2) + pow(g[y + 1][x + 1] - g[y][x], 2) + pow(g[y + 1][x] - g[y][x], 2) + pow(g[y + 1][x + 1] - g[y + 1][x], 2); ll sb = pow(b[y][x + 1] - b[y][x], 2) + pow(b[y + 1][x + 1] - b[y][x], 2) + pow(b[y + 1][x] - b[y][x], 2) + pow(b[y + 1][x + 1] - b[y + 1][x], 2); return sr + sg + sb; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double ave = 0; int n = 500; random_device rnd; mt19937 mt(rnd()); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { r[i][j] = R[i][j]; g[i][j] = G[i][j]; b[i][j] = B[i][j]; } } vector<ll> v; for (int k = 0; k < 200; k++) { int y = mt() % 499, x = mt() % 499; v.push_back(check(y, x)); } // cout << v[100] << endl; sort(v.begin(), v.end()); if (v[100] >= 10000) { return 3; } else if (v[100] >= 800) { return 2; } else { ll s = 0; for (int k = 0; k < 100; k++) { int y = mt() % 500, x = mt() % 500; s += r[y][x] * g[y][x] * b[y][x]; } //cout << s << endl; s /= 100; if (s >= 5000000) { return 1; } else { return 4; } } }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:19:12: warning: unused variable 'ave' [-Wunused-variable]
     double ave = 0;
            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...