제출 #427414

#제출 시각아이디문제언어결과실행 시간메모리
427414AmineWeslati미술 수업 (IOI13_artclass)C++14
3 / 100
246 ms6132 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int>vi; #define pb push_back #define sz(v) (int)v.size() typedef pair<int,int>pi; #define fi first #define se second typedef vector<pi>vpi; #define eb emplace_back #define FOR(i,a,b) for(int i=a; i<b; i++) #define ROF(i,a,b) for(int i=b-1; i>=a; i--) void ckmax(int &x, int y){x=max(x,y);} void ckmin(int &x, int y){x=min(x,y);} const int MX=1e5+10; //----------------------------- int random(int l, int r){ int ans=l; if(r>l){ ans+=rand()%(r-l); } return ans; } int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) { int H=N,W=M; int cnt=0; FOR(i,0,N) FOR(j,0,M){ if(G[i][j]>=max(B[i][j],R[i][j])) cnt++; } if(cnt>=H*W/3) return 2; int f=0; int rep=1e6; while(rep--){ int x=random(0,N-1),y=random(0,M-1); int xx=random(0,N-1),yy=random(0,M-1); if(abs(R[x][y]-R[xx][yy])>=50) f=1; if(abs(G[x][y]-G[xx][yy])>=50) f=1; if(abs(B[x][y]-B[xx][yy])>=50) f=1; } if(f) return 1; cnt=0; FOR(i,0,N) FOR(j,0,M){ if(R[i][j]>=max(B[i][j],G[i][j])) cnt++; } if(cnt>=H*W/3) return 4; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...