Submission #1140729
Source Code Expand
#include<iostream> #include<queue> #include<map> using namespace std; priority_queue<pair<int,int>,vector<pair<int,int> >,greater<pair<int,int> > > q1; int s[1000][10][2]; int a[55][55]; int all=0; int miss=0; void search(int x,int y){ int n=50; int i,j,k; int b,c; while(!q1.empty()){q1.pop();} q1.push(make_pair(a[x][y],x*n+y)); for(k=0;k<8;k++){ while(1){ if(q1.empty()){ miss=1; return; } c=q1.top().first; b=q1.top().second; q1.pop(); x=b/n,y=b%n; if(c==a[x][y])break; if(a[x][y]==0)continue; q1.push(make_pair(a[x][y],b)); } s[all][k][0]=x; s[all][k][1]=y; a[x][y]=0; for(i=-1;i<=1;i++){ for(j=-1;j<=1;j++){ if((i+j+10)%2==0)continue; if(a[x+i][y+j]==0)continue; b=(x+i)*n+y+j; q1.push(make_pair(a[x+i][y+j],b)); } } } all++; } int main(){ int n=50,m=8; int i,j,k; char ca[100],cb; cin>>n>>n>>m; for(i=0;i<n;i++){ cin>>ca; for(j=0;j<n;j++){ for(k=0,cb='0';k<10;k++,cb++){ if(ca[j]==cb){ a[i][j]=k; break; } } } } for(i=9;i>0;i--){ for(j=0;j<n;j++){ for(k=0;k<n;k++){ if(a[j][k]==i)search(j,k); if(miss)break; } if(miss)break; } if(miss)break; } cout<<all<<endl; for(i=0;i<all;i++){ for(j=0;j<m;j++){ cout<<s[i][j][0]<<" "<<s[i][j][1]<<endl; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Multiple Pieces |
User | moririn2528 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1420 Byte |
Status | RE |
Exec Time | 393 ms |
Memory | 256 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 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 1343058 | 0 / 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 | RE | 393 ms | 256 KB |
subtask_01_02.txt | WA | 1 ms | 256 KB |
subtask_01_03.txt | WA | 1 ms | 256 KB |
subtask_01_04.txt | WA | 2 ms | 256 KB |
subtask_01_05.txt | WA | 1 ms | 256 KB |
subtask_01_06.txt | WA | 1 ms | 256 KB |
subtask_01_07.txt | WA | 1 ms | 256 KB |
subtask_01_08.txt | WA | 1 ms | 256 KB |
subtask_01_09.txt | WA | 1 ms | 256 KB |
subtask_01_10.txt | WA | 1 ms | 256 KB |