Submission #155915

#TimeUsernameProblemLanguageResultExecution timeMemory
155915qkxwsmArt Class (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; template<class T, class U> void ckmin(T &a, U b) { if (a > b) a = b; } template<class T, class U> void ckmax(T &a, U b) { if (a < b) a = b; } #define MP make_pair #define PB push_back #define LB lower_bound #define UB upper_bound #define fi first #define se second #define FOR(i, a, b) for (auto i = (a); i < (b); i++) #define FORD(i, a, b) for (auto i = (a) - 1; i >= (b); i--) #define SZ(x) ((int) ((x).size())) #define ALL(x) (x).begin(), (x).end() typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<pii> vpi; typedef vector<pll> vpl; typedef pair<ld, ld> pdd; typedef vector<vector<array<int, 3> > > img; int ans; img grid; pdd vals[4] = {{2881.444444,44.127767}, {6595.888889,42.364511}, {7891.444444,32.885922}, {2518.333333,117.028611}}; ld co; pdd calc(img f) { //amount of black? //number of distinct colors? pdd res = {0, 0}; set<array<int, 3> > s; FOR(i, 0, 100) { FOR(j, 0, 100) { array<int, 3> cur = f[i][j]; ld mx = max(cur[0], max(cur[1], cur[2])); ld mn = min(cur[0], min(cur[1], cur[2])); res.se += (mx - mn); // FOR(k, 0, 3) cur[i] /= 10; s.insert(cur); } } res.se /= 10000.0; res.fi = SZ(s); return res; } ld dist(pdd a, pdd b) { return (a.fi - b.fi) * (a.fi - b.fi) + co * (a.se - b.se) * (a.se - b.se); } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { //calculate some quantity of grid.resize(H); FOR(i, 0, H) { grid[i].resize(W); FOR(j, 0, W) { grid[i][j][0] = R[i][j]; grid[i][j][1] = G[i][j]; grid[i][j][2] = B[i][j]; } } ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0])); ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1])); co = (dl / dr) * (dl / dr); auto cur = calc(grid); ans = 0; FOR(i, 1, 4) { if (dist(cur, vals[i]) < dist(cur, vals[ans])) { ans = i; } } return ans + 1; //calculate the minimum }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:85:25: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                         ^
artclass.cpp:85:37: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                     ^
artclass.cpp:85:54: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                      ^
artclass.cpp:85:66: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                                  ^
artclass.cpp:85:89: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                                                         ^
artclass.cpp:85:101: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                                                                     ^
artclass.cpp:85:118: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                                                                                      ^
artclass.cpp:85:130: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dl = max(max(vals[0][0], vals[1][0]), max(vals[2][0], vals[3][0])) - min(min(vals[0][0], vals[1][0]), min(vals[2][0], vals[3][0]));
                                                                                                                                  ^
artclass.cpp:86:25: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                         ^
artclass.cpp:86:37: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                     ^
artclass.cpp:86:54: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                      ^
artclass.cpp:86:66: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                                  ^
artclass.cpp:86:89: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                                                         ^
artclass.cpp:86:101: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                                                                     ^
artclass.cpp:86:118: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                                                                                      ^
artclass.cpp:86:130: error: no match for 'operator[]' (operand types are 'pdd {aka std::pair<long double, long double>}' and 'int')
  ld dr = max(max(vals[0][1], vals[1][1]), max(vals[2][1], vals[3][1])) - min(min(vals[0][1], vals[1][1]), min(vals[2][1], vals[3][1]));
                                                                                                                                  ^