제출 #126217

#제출 시각아이디문제언어결과실행 시간메모리
126217nxteru미술 수업 (IOI13_artclass)C++14
0 / 100
167 ms35300 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; #define D 20 #define K 300 #define PB push_back int s,t[10005],sz,ch; vector<int>q[250005]; bool vis[250005]; void dfs(int v){ vis[v]=true; s++; if(s>10000)return; for(int i=0;i<q[v].size();i++){ int u=q[v][i]; if(!vis[u])dfs(u); } } int style(int h, int w, int r[500][500], int g[500][500], int b[500][500]) { //cout<<h<<' '<<w<<endl; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ if(j+1<w&&abs(r[i][j]-r[i][j+1])<D&&abs(g[i][j]-g[i][j+1])<D&&abs(b[i][j]-b[i][j+1])<D){ q[i*w+j].PB(i*w+j+1); q[i*w+j+1].PB(i*w+j); } if(j+1<w&&abs(r[i][j]-r[i][j+1])+abs(g[i][j]-g[i][j+1])+abs(b[i][j]-b[i][j+1])>K){ ch++; } if(i+1<h&&abs(r[i][j]-r[i+1][j])<D&&abs(g[i][j]-g[i+1][j])<D&&abs(b[i][j]-b[i+1][j])<D){ q[i*w+j].PB((i+1)*w+j); q[(i+1)*w+j].PB(i*w+j); } if(i+1<h&&abs(r[i][j]-r[i+1][j])+abs(g[i][j]-g[i+1][j])+abs(b[i][j]-b[i+1][j])>K){ ch++; } vis[i*w+j]=false; } } for(int i=0;i<h*w;i++){ if(!vis[i]){ s=0; dfs(i); sz++; } } //cout<<sz<<endl; //cout<<ch<<endl; if(sz<250||ch<10)return 4; vis[-1000000000]=true; if(sz>39000)return 3; if(ch<500)return 2; return 1; }

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

artclass.cpp: In function 'void dfs(int)':
artclass.cpp:14:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<q[v].size();i++){
              ~^~~~~~~~~~~~
artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:50:17: warning: array subscript is below array bounds [-Warray-bounds]
  vis[-1000000000]=true;
  ~~~~~~~~~~~~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...