Submission #9889132
Source Code Expand
#define _USE_MATH_DEFINES #include <iostream> #include <string> #include <utility> #include <stack> #include <vector> #include <queue> #include <algorithm> #include <map> #include <climits> #include <set> #include <cmath> #include <numeric> #include <iomanip> #include <random> #include <chrono> using namespace std; const int N = 30; int A[30][30]; int ans_size = 0; int h_moves[4] = {-1, 1, 0, 0}; int w_moves[4] = {0, 0, -1, 1}; vector <pair<int, int> > ans; chrono::system_clock::time_point start; chrono::system_clock::time_point cur_time; void input(){ for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ cin >> A[i][j]; } } } void solve(){ for(int i = 0; i < N; i++){ for(int j = 0; j < N; j++){ while(A[i][j] != 0){ ans.push_back(make_pair(i + 1, j + 1)); ans_size ++; A[i][j] --; int cur_i = i; int cur_j = j; while(true){ bool changed = false; cout << cur_i << " " << cur_j << endl; for(int k = 0; k < 4; k++){ int next_i = i + h_moves[k]; int next_j = j + w_moves[k]; if(0 <= next_i && next_i < N && 0 <= next_j && next_j < N){ if(A[cur_i][cur_j] == A[next_i][next_j] && A[next_i][next_j] != 0){ ans.push_back(make_pair(next_i + 1, next_j + 1)); A[next_i][next_j] --; changed = true; cur_i = next_i; cur_j = next_j; break; } } } if(!changed){ break; } } } } } } void output(){ for(int i = 0; i < ans.size(); i++){ cout << ans[i].first << " " << ans[i].second << endl; } } int main(void){ start = chrono::system_clock::now(); input(); solve(); output(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - 高橋君の山崩しゲーム |
User | katom |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1928 Byte |
Status | WA |
Exec Time | 156 ms |
Memory | 1272 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 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 100000 | 0 / 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 | WA | 145 ms | 1144 KB |
subtask_01_02.txt | WA | 152 ms | 1272 KB |
subtask_01_03.txt | WA | 147 ms | 1144 KB |
subtask_01_04.txt | WA | 156 ms | 1272 KB |
subtask_01_05.txt | WA | 149 ms | 1144 KB |
subtask_01_06.txt | WA | 147 ms | 1144 KB |
subtask_01_07.txt | WA | 156 ms | 1272 KB |
subtask_01_08.txt | WA | 144 ms | 1144 KB |
subtask_01_09.txt | WA | 156 ms | 1272 KB |
subtask_01_10.txt | WA | 151 ms | 1272 KB |