Submission #69868

#TimeUsernameProblemLanguageResultExecution timeMemory
69868FLDutchmanArt Class (IOI13_artclass)C++14
Compilation error
0 ms0 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; typedef int INT; #define FOR(i,l,r) for(int i = (l); i < (r); i++) #define fst first #define snd second #define pb push_back #define mp make_pair #define V vector #define int long long typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<vi> vvi; typedef vector<ii> vii; const int NMAX = 1e5+10; double sqr(double x) {return x * x;} struct color{ double r, g, b; double l; color (){} color (int r, int g, int b) : r(r), g(g), b(b) {l = sqrt(r*r + g*g + b*b);} int operator- (const color &c) { //cerr<<r/l<<endl; return abs(l-c.l); //abs(r/l-c.r/c.l) + abs(g/l-c.g/c.l) + abs(b/l-c.b/c.l); } }; V<V<color>> canvas(0); int H = 0, W = 0; double diff(){ double tot = 0; double div = 0; FOR(i, 1, H) FOR(j, 1, W){ if(i > 0) {tot += canvas[i][j] - canvas[i-1][j]; div++;} if(j > 0) {tot += canvas[i][j] - canvas[i][j-1]; div++;} } return tot / div; } double diff(string s){ ifstream fin(s); fin >> H >> W; canvas.assign(H, V<color>(W)); FOR(i, 0, H) FOR(j, 0, W){ int r,g,b; fin>>r>>g>>b; canvas[i][j] = {r, g, b}; } double tot = 0; double div = 0; FOR(i, 0, H) FOR(j, 0, W){ if(i > 0) {tot += canvas[i][j] - canvas[i-1][j]; div += 1;} if(j > 0) {tot += canvas[i][j] - canvas[i][j-1]; div += 1;} } return tot / div; } INT style(INT h, INT w, INT R[500][500], INT G[500][500], INT B[500][500]) { H=h; W=w; canvas.assign(H, V<color>(W)); FOR(i, 0, H) FOR(j, 0, W){ canvas[i][j] = color(R[i][j], G[i][j], B[i][j]); } double k = 10 * diff(); if(k <= 40) return 4; if(k <= 115) return 1; if(k <= 300) return 2; return 3; } signed main(){ cout << setprecision(3); FOR(style, 1, 5) { FOR(i, 1, 10) cout << (int) (10*diff("style-"+to_string(style)+"-"+to_string(i)+".txt") ) << "\t"; cout << endl; } }

Compilation message (stderr)

/tmp/cc8kPYtq.o: In function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccaBXwav.o:grader.c:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status