Submission #8246186
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x,h,w) (y) < 0 || (h) <= (y) || (x) < 0 || (w) <= (x)
const ll INF = 1000000000;
const ll LLINF = 1LL << 60;
const ll mod = 1000000007;
const ll MOD = 998244353;
const long double pi = acos(-1);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& input, vector<T>& v) { for (auto& elemnt : v)input >> elemnt; return input; }
vector<VI> a(30, VI(30));
int dy[] = { -1, 0, 0, 1 }, dx[] = { 0, -1, 1, 0 };
void solve(int y, int x){
--a[y][x];
cout << y + 1 << " " << x + 1 << "\n";
FOR(i, 0, 4){
int ny = y + dy[i], nx = x + dx[i];
if (out(ny, nx, 30, 30))continue;
if (a[ny][nx] && (a[y][x] == a[ny][nx])){
solve(ny, nx);
break;
}
}
}
int main() {
init();
FOR(i, 0, 30)cin >> a[i];
vector<tuple<int, int, int>> dat;
FOR(y, 0, 30)FOR(x, 0, 30){
dat.push_back(make_tuple(a[y][x], y, x));
}
SORT(dat);
rFOR(i,0,900){
int y = get<1>(dat[i]), x = get<2>(dat[i]);
while(a[y][x])solve(y, x);
}
}
Submission Info
Submission Time |
|
Task |
A - 高橋君の山崩しゲーム |
User |
first_vil |
Language |
C++14 (GCC 5.4.1) |
Score |
776547 |
Code Size |
1855 Byte |
Status |
AC |
Exec Time |
8 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 |
77564 / 100000 |
77016 / 100000 |
77992 / 100000 |
77284 / 100000 |
77376 / 100000 |
77758 / 100000 |
78192 / 100000 |
78062 / 100000 |
77609 / 100000 |
77694 / 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 |
8 ms |
512 KB |
subtask_01_02.txt |
AC |
8 ms |
512 KB |
subtask_01_03.txt |
AC |
8 ms |
512 KB |
subtask_01_04.txt |
AC |
8 ms |
512 KB |
subtask_01_05.txt |
AC |
8 ms |
512 KB |
subtask_01_06.txt |
AC |
8 ms |
512 KB |
subtask_01_07.txt |
AC |
8 ms |
512 KB |
subtask_01_08.txt |
AC |
8 ms |
512 KB |
subtask_01_09.txt |
AC |
8 ms |
512 KB |
subtask_01_10.txt |
AC |
8 ms |
512 KB |