Submission #8241973
Source Code Expand
#include<iostream> #include<vector> #include<algorithm> using namespace std; typedef long long ll; typedef pair<ll,ll> P; signed main(){ ll a[30][30],max_a,vx[]={1,0,-1,0},vy[]={0,1,0,-1}; ll x,y,nx,ny,n=30,next_a,gx,gy; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin >> a[i][j]; } } while(true){ max_a = 0; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(max_a < a[i][j]){ x = i; y = j; max_a = a[i][j]; } } } if(max_a==0){ break; } cout << x+1<<" "<<y+1<<endl; a[x][y]--; while(true){ next_a = 0; for(int i=0;i<4;i++){ nx = x+vx[i]; ny = y+vy[i]; if(nx>=0&&ny>=0&&nx<n&&ny<n&&next_a<a[nx][ny]){ next_a = a[nx][ny]; gx = nx; gy = ny; } } if(next_a==0||next_a<a[x][y]){ break; }else{ cout << gx+1 <<" "<<gy+1 <<endl; a[gx][gy]--; x = gx; y = gy; } } } }
Submission Info
Submission Time | |
---|---|
Task | A - 高橋君の山崩しゲーム |
User | shop_one |
Language | C++14 (GCC 5.4.1) |
Score | 673739 |
Code Size | 1070 Byte |
Status | AC |
Exec Time | 87 ms |
Memory | 512 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 | 68206 / 100000 | 66914 / 100000 | 67869 / 100000 | 65634 / 100000 | 67901 / 100000 | 67872 / 100000 | 66969 / 100000 | 68534 / 100000 | 67501 / 100000 | 66339 / 100000 | ||||||||||||||||||||
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 | 80 ms | 512 KB |
subtask_01_02.txt | AC | 84 ms | 512 KB |
subtask_01_03.txt | AC | 81 ms | 512 KB |
subtask_01_04.txt | AC | 87 ms | 512 KB |
subtask_01_05.txt | AC | 83 ms | 512 KB |
subtask_01_06.txt | AC | 82 ms | 512 KB |
subtask_01_07.txt | AC | 83 ms | 512 KB |
subtask_01_08.txt | AC | 81 ms | 512 KB |
subtask_01_09.txt | AC | 83 ms | 512 KB |
subtask_01_10.txt | AC | 83 ms | 512 KB |