제출 #383611

#제출 시각아이디문제언어결과실행 시간메모리
383611alishahali1382Art Class (IOI13_artclass)C++14
컴파일 에러
0 ms0 KiB
//#include "artclass.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O2,unroll-loops") using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typedef pair<pii, int> piii; typedef pair<ll, ll> pll; #define debug(x) cerr<<#x<<'='<<(x)<<endl; #define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl; #define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl; #define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;} #define all(x) x.begin(), x.end() #define pb push_back #define kill(x) return cout<<x<<'\n', 0; const int inf=1000000010; const ll INF=1000000000000001000LL; const int mod=1000000007; const int MAXN=500; int n, m, k, u, v, x, y, t, a, b, ted, comp, green; int par[MAXN*MAXN]; int R[500][500], G[500][500], B[500][500]; int dx[]={0, +1, 0, -1}; int dy[]={-1, 0, +1, 0}; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); inline int diff(int x, int y, int xx, int yy){ return abs(R[x][y]-R[xx][yy])+abs(G[x][y]-G[xx][yy])+abs(B[x][y]-B[xx][yy]); } int getpar(int x){ return (par[x]==x?x:par[x]=getpar(par[x]));} int join(int x, int y){ x=getpar(x); y=getpar(y); par[x]=y; return (x!=y); } int style(int nn, int mm, int RR[500][500], int GG[500][500], int BB[500][500]) { n=nn; m=mm; for (int i=0; i<n; i++) for (int j=0; j<m; j++){ R[i][j]=RR[i][j]; G[i][j]=GG[i][j]; B[i][j]=BB[i][j]; } for (int i=0; i<n; i++) for (int j=0; j<m; j++){ ld r=R[i][j], g=G[i][j], b=B[i][j], sum=r+g+b; if (sum!=0 && g/sum>.4) green++; } iota(par, par+n*m, 0); comp=n*m; for (int i=0; i<n; i++) for (int j=0; j<m; j++){ if (i<n-1 && diff(i, j, i+1, j)<=100) comp-=join(i*m+j, (i+1)*m+j); if (j<m-1 && diff(i, j, i, j+1)<=100) comp-=join(i*m+j, i*m+(j+1)); } ld S=0; for (int i=0; i<n; i++) for (int j=0; j+1<m; j++) S+=diff(i, j, i, j+1); S/=n*m; if (S>50) return 3; if (S<=8) return 4; // cerr<<"S: "<<setprecision(10)<<fixed<<S<<"\n"; // debug(green) // debug(comp) if (green>=n*m/4) return 2; return 1; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n>>m; for (int i=0; i<n; i++) for (int j=0; j<m; j++) cin>>R[i][j]>>G[i][j]>>B[i][j]; cout<<"ans: "<<style(n, m, R, G, B)<<"\n"; // style(n, m, R, G, B); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

/tmp/ccmRFZkF.o: In function `main':
artclass.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccC6xphJ.o:grader.c:(.text.startup+0x0): first defined here
/tmp/ccC6xphJ.o: In function `main':
grader.c:(.text.startup+0x213): undefined reference to `style'
collect2: error: ld returned 1 exit status