Submission #2079300
Source Code Expand
#include <iostream> #include <cstdio> #include <vector> #include <map> #include <string> #include <utility> #include <algorithm> #include <functional> #include <climits> #include <math.h> #include <iomanip> #include <fstream> using namespace std; bool ff[50][50]={}; int tmp; int tmpx,tmpy; int pix[8][10000],piy[8][10000]; int pic=0; int f[50][50]={}; void pi(int n,int x,int y){ if(n==0){pic++; /*for(int i=0;i<8;++i){ cout<<pix[i]<<" "<<piy[i]<<endl; }*/ return;} tmp=-1; if(x>=0&&x<50&&y-1>=0&&y-1<50){if(ff[x][y-1]==0&&tmp<f[x][y-1]){tmp=f[x][y-1];tmpx=x;tmpy=y-1;}} if(x>=0&&x<50&&y+1>=0&&y+1<50){if(ff[x][y+1]==0&&tmp<f[x][y+1]){tmp=f[x][y+1];tmpx=x;tmpy=y+1;}} if(x-1>=0&&x-1<50&&y>=0&&y<50){if(ff[x-1][y]==0&&tmp<f[x-1][y]){tmp=f[x-1][y];tmpx=x-1;tmpy=y;}} if(x+1>=0&&x+1<50&&y>=0&&y<50){if(ff[x+1][y]==0&&tmp<f[x+1][y]){tmp=f[x+1][y];tmpx=x+1;tmpy=y;}} if(tmp<0||tmpx<0||tmpx>50||tmpy<0||tmpy>50){return;} ff[tmpx][tmpy]=1; pix[n-1][pic]=tmpx; piy[n-1][pic]=tmpy; pi(n-1,tmpx,tmpy); return; } int main() { //cin.tie(0); //ios::sync_with_stdio(false); //std::ifstream in("input.txt"); //std::cin.rdbuf(in.rdbuf()); int h,w,k; cin >> h >> w >> k; string s; char c; for(int i=0;i<50;++i){ cin>>s; //cout<<s<<endl; for(int j=0;j<50;++j){ c=s[j]; f[i][j]=c-'0'; } } for(int i=0;i<50;++i){ for(int j=0;j<50;++j){ if(ff[i][j]==0&&f[i][j]!=0){ff[i][j]=1;pix[7][pic]=i;piy[7][pic]=j;pi(7,i,j);} } } cout<<pic<<endl; for(int i=0;i<pic;++i){ for(int j=0;j<8;++j){ cout<<pix[j][i]+1<<" "<<piy[j][i]+1<<endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Pieces |
User | bono_bono |
Language | C++14 (GCC 5.4.1) |
Score | 132339 |
Code Size | 1859 Byte |
Status | AC |
Exec Time | 5 ms |
Memory | 384 KB |
Judge Result
Set Name | test_01 | test_02 | test_03 | test_04 | test_05 | test_06 | test_07 | test_08 | test_09 | test_10 | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 11998 / 1343058 | 12588 / 1343058 | 15782 / 1343058 | 10532 / 1343058 | 13782 / 1343058 | 12238 / 1343058 | 14209 / 1343058 | 9784 / 1343058 | 13426 / 1343058 | 18000 / 1343058 | ||||||||||||||||||||
Status |
|
|
|
|
|
|
|
|
|
|
Set Name | Test Cases |
---|---|
test_01 | subtask_01_01.txt |
test_02 | subtask_01_02.txt |
test_03 | subtask_01_03.txt |
test_04 | subtask_01_04.txt |
test_05 | subtask_01_05.txt |
test_06 | subtask_01_06.txt |
test_07 | subtask_01_07.txt |
test_08 | subtask_01_08.txt |
test_09 | subtask_01_09.txt |
test_10 | subtask_01_10.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask_01_01.txt | AC | 5 ms | 384 KB |
subtask_01_02.txt | AC | 5 ms | 384 KB |
subtask_01_03.txt | AC | 5 ms | 384 KB |
subtask_01_04.txt | AC | 5 ms | 384 KB |
subtask_01_05.txt | AC | 5 ms | 384 KB |
subtask_01_06.txt | AC | 5 ms | 384 KB |
subtask_01_07.txt | AC | 5 ms | 384 KB |
subtask_01_08.txt | AC | 5 ms | 384 KB |
subtask_01_09.txt | AC | 5 ms | 384 KB |
subtask_01_10.txt | AC | 5 ms | 384 KB |