Submission #1414254
Source Code Expand
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;
#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3
int h, w, k;
string table[100];
vector<vector<P>> vvp;
bool isused[100][100];
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
vector<P> solve(int i, int j) {
vector<P> res;
rep(k, 8) {
if (j + k < w && !isused[i][j + k])res.push_back({ i + 1, j + k + 1 });
else {
res.clear();
return res;
}
}
rep(k, 8)isused[i][j + k] = 1;
return res;
}
int main() {
cin >> h >> w >> k;
rep(i, h) {
cin >> table[i];
rep(j, w) {
if (table[i][j] - '0' == 0)isused[i][j] = 1;
}
}
//rep(i, 10) {
// //cout << table[i] << endl;
// rep(j, 10)cout << isused[i][j];
// cout << endl;
//}
for (int i = 0; i < 50; i++) {
for (int j = 0; j < 50; j++) {
if (!isused[i][j]) {
vector<P> buf = solve(i, j);
if (!buf.empty())vvp.push_back(buf);
}
}
}
cout << vvp.size() << endl;
rep(i, vvp.size()) {
if (vvp[i].empty())continue;
rep(j, vvp[i].size()) {
cout << vvp[i][j].first << " " << vvp[i][j].second << endl;
}
}
}
Submission Info
Submission Time |
|
Task |
A - Multiple Pieces |
User |
jimmy |
Language |
C++14 (GCC 5.4.1) |
Score |
67411 |
Code Size |
1975 Byte |
Status |
AC |
Exec Time |
4 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 |
7915 / 1343058 |
4985 / 1343058 |
8789 / 1343058 |
7969 / 1343058 |
7613 / 1343058 |
6521 / 1343058 |
4673 / 1343058 |
4855 / 1343058 |
6452 / 1343058 |
7639 / 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 |
AC |
4 ms |
256 KB |
subtask_01_02.txt |
AC |
4 ms |
256 KB |
subtask_01_03.txt |
AC |
4 ms |
256 KB |
subtask_01_04.txt |
AC |
4 ms |
256 KB |
subtask_01_05.txt |
AC |
4 ms |
256 KB |
subtask_01_06.txt |
AC |
4 ms |
256 KB |
subtask_01_07.txt |
AC |
4 ms |
256 KB |
subtask_01_08.txt |
AC |
4 ms |
256 KB |
subtask_01_09.txt |
AC |
4 ms |
256 KB |
subtask_01_10.txt |
AC |
4 ms |
256 KB |