Submission #140316

#TimeUsernameProblemLanguageResultExecution timeMemory
140316SeekingOblivionTetris (COCI17_tetris)C++14
80 / 80
2 ms380 KiB
#include<iostream> #include<fstream> #define fin cin #define fout cout #include<vector> using namespace std; //ifstream fin("date.in"); //ofstream fout("date.out"); int i,j,a,ss,nr,ds,sj,dj,s,d,n,m,f[6]; int ddi[4]={0,0,1,-1}; int ddj[4]={-1,1,0,0}; char v[15][15]; void fil(int x,int y) { char val=v[x][y]; if(y==s) { if(x<ss) ss=x; if(x>sj) sj=x; } if(y<s) s=y,ss=x,sj=x; if(y==d) { if(x<ds) ds=x; if(x>dj) dj=x; } if(y>d) d=y,ds=x,dj=x; v[x][y]='.'; int ix,iy; for(int dd=0;dd<=3;dd++) { ix=x+ddi[dd]; iy=y+ddj[dd]; if(ix>=0&&iy>=0&&ix<n&&iy<m&&v[ix][iy]==val) fil(ix,iy); } } int main(){ fin>>n>>m; for(i=0;i<n;i++) fin>>v[i]; for(i=0;i<n;i++) for(j=0;j<m;j++) { if(v[i][j]!='.') { d=-1;s=10001;nr++; fil(i,j); if(ss==sj&&ds==dj) { if(ds>ss) f[4]++; if(ds<ss) f[3]++; if(ds==ss) { if(d-s==2) f[5]++; else f[2]++; } continue; } if(ss==sj||ds==dj){f[5]++;continue;} if(s==d){f[2]++;continue;} if(ds==ss) f[1]++; if(ds>ss) f[3]++; if(ds<ss) f[4]++; } } for(nr=1;nr<=5;nr++) fout<<f[nr]<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...