답안 #61303

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
61303 2018-07-25T15:39:19 Z istlemin 웜뱃 (IOI13_wombats) C++14
컴파일 오류
0 ms 0 KB
#include "artclass.h"
#include<bits/stdc++.h>

using namespace std;

#define rep(i,a,b) for(int i = a; i<int(b);++i)
#define all(v) v.begin(),v.end()
#define sz(v) v.size()
#define trav(a,c) for(auto a: c)

typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pii;

ll h,w;
vector<vi> r,g,b;

vi getDiffs(ll dh,ll dw){
    vi diffs(256);
    rep(i,0,h){
        rep(j,0,w){
            if(i+dh<h){
				diffs[abs(r[i][j]-r[i+dh][j])]++;
				diffs[abs(g[i][j]-g[i+dh][j])]++;
				diffs[abs(b[i][j]-b[i+dh][j])]++;
            }
            if(j+dw<w){
				diffs[abs(r[i][j]-r[i][j+dw])]++;
				diffs[abs(g[i][j]-g[i][j+dw])]++;
				diffs[abs(b[i][j]-b[i][j+dw])]++;
            }
        }
    }
    return diffs;
}

bool hasWhiteSquare(ll sh,ll sw){
    rep(i1,0,h-sh+1)
		rep(j1,0,w-sw+1){
			bool allWhite = true;
            rep(i,i1,i1+sh)
				rep(j,j1,j1+sw){
                    allWhite &= (r[i][j]>=200);
                    allWhite &= (g[i][j]>=200);
                    allWhite &= (b[i][j]>=200);
				}
			if(allWhite) return true;
		}
	return false;
}

ll numSquares(ll sh,ll sw){
	ll ans = 0;
    rep(i1,0,h-sh+1)
		rep(j1,0,w-sw+1){
            double sumR = 0;
            double sumG = 0;
            double sumB = 0;
            rep(i,i1,i1+sh)
				rep(j,j1,j1+sw){
					sumR += r[i][j];
					sumG += g[i][j];
					sumB += b[i][j];
				}
			sumR /= sh*sw;
			sumG /= sh*sw;
			sumB /= sh*sw;
            double stdR = 0;
            double stdG = 0;
            double stdB = 0;
            rep(i,i1,i1+sh)
				rep(j,j1,j1+sw){
					stdR += (r[i][j]-sumR)*(r[i][j]-sumR);
					stdG += (r[i][j]-sumG)*(r[i][j]-sumG);
					stdB += (r[i][j]-sumB)*(r[i][j]-sumB);
				}
			if((stdR+stdG+stdB)/double(sh)/double(sw)<50){
                ans++;
			}
		}
    return ans;
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    h = H; w = W;
    r.resize(h,vi(w));
    g.resize(h,vi(w));
    b.resize(h,vi(w));

	ll greenSum = 0;
    ll rSum = 0;
    ll gSum = 0;
    ll bSum = 0;

	rep(i,0,h) rep(j,0,w){
		rSum += r[i][j] = R[i][j];
		gSum += g[i][j] = G[i][j];
		bSum += b[i][j] = B[i][j];
	}

    if(gSum>h*w*70) return 2;

	//cout<<numSquares(10,10)<<endl;
	//cout<<hasWhiteSquare(10,10)<<endl;
	return 1;

	/*
    vi segments = {0,10,30,80,150,256};

    vi vals(segments.size()-1);

    vi diffs = getDiffs(1,1);

    rep(i,0,segments.size()-1){
        rep(j,segments[i],segments[i+1]){
            vals[i]+=diffs[j];
        }
        //cout<<setw(10)<<vals[i]<<" ";
    }
    //cout<<endl;

    ll types[4][5] =
    {{1234884,80130,30000,10000,1000},
    {505709,356111,67631,2924,50},
    {201382,396123,228773,54461,1183},
    {869868,17804,2046,300,0}};

    ll mnErr = 1e18;
    ll best = 0;

    rep(i,0,4){
        ll err = 0;
        vi facs = {1,5,100,100,1000};
        rep(j,0,vals.size()){
			ll currErr = 1e18;
			if(types[i][j]!=0)
				currErr = min(currErr,abs(types[i][j]-vals[i])*ll(1e4)/types[i][j]);
				cout<<currErr<<" ";
			currErr = abs(types[i][j]-vals[i]);
				cout<<currErr<<endl;
			currErr = abs(types[i][j]-vals[i])*facs[j];
			err += currErr;
        }
		cout<<err<<endl;
        if(err<mnErr){
			mnErr = err;
            best = i;
        }
    }
	cout<<best+1<<endl;
    return best+1;*/
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
  int res;
      ^~~
wombats.cpp:1:10: fatal error: artclass.h: No such file or directory
 #include "artclass.h"
          ^~~~~~~~~~~~
compilation terminated.