Submission #8244345
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);i++)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;i--)
#define FOR(i,s,n) for(int i = s;i < (int)n;i++)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;i--)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr long long INF = 1e18;
constexpr long long N = 30;
int dx[] = {0,1,0,-1};
int dy[] = {1,0,-1,0};
signed main(){
vector<vector<int>>a(N,vector<int>(N));
REP(i,N)REP(j,N)cin>>a[i][j];
vector<pair<int,int>>ans;
auto f = [&](int i,int j,auto&&ff)->void{
ans.push_back({i,j});
a[i][j]--;
REP(k,4){
int ni = i + dx[k],nj = j + dy[k];
if(!IN(0,ni,30))continue;
if(!IN(0,nj,30))continue;
if(a[i][j]&&a[i][j]==a[ni][nj])ff(ni,nj,ff);
}
};
REP(i,N)REP(j,N)while(a[i][j])f(i,j,f);
for(auto e:ans)cout<<e.first+1<<" "<<e.second+1<<endl;
}
Submission Info
Submission Time |
|
Task |
A - 高橋君の山崩しゲーム |
User |
chocopuu |
Language |
C++14 (GCC 5.4.1) |
Score |
732269 |
Code Size |
1106 Byte |
Status |
AC |
Exec Time |
80 ms |
Memory |
1404 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 |
74342 / 100000 |
72452 / 100000 |
73235 / 100000 |
71474 / 100000 |
73730 / 100000 |
73320 / 100000 |
72898 / 100000 |
74689 / 100000 |
72772 / 100000 |
73357 / 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 |
73 ms |
1404 KB |
subtask_01_02.txt |
AC |
77 ms |
1404 KB |
subtask_01_03.txt |
AC |
75 ms |
1404 KB |
subtask_01_04.txt |
AC |
80 ms |
1404 KB |
subtask_01_05.txt |
AC |
75 ms |
1404 KB |
subtask_01_06.txt |
AC |
75 ms |
1404 KB |
subtask_01_07.txt |
AC |
78 ms |
1404 KB |
subtask_01_08.txt |
AC |
72 ms |
1404 KB |
subtask_01_09.txt |
AC |
76 ms |
1404 KB |
subtask_01_10.txt |
AC |
75 ms |
1404 KB |