Submission #1140720
Source Code Expand
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>
#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x) cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR
#endif
using namespace std;
using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;
//struct edge {int from, to, cost;};
constexpr double EPS = 1e-10;
constexpr double PI = acos(-1.0);
//constexpr int INF = INT_MAX;
template<class T> inline T sqr(T x) {return x*x;}
int a[50][50];
int main() {
int h,w,k;
cin >> h >> w >> k;
char c;
REP(i,0,h) REP(j,0,w) {
cin >> c;
a[i][j] = c - '0';
}
int cnt = 0;
REP(i,0,h) {
int pos = 0;
while (pos <= w - k) {
bool b = true;
REP(j,0,k) {
if (a[i][pos+j] == 0) {
b = false;
pos += j + 1;
break;
}
}
if (b) {
/*REP(j,pos,k) {
cout << i << " " << j << endl;
}*/
cnt++;
pos += 8;
}
}
}
cout << cnt << endl;
REP(i,0,h) {
int pos = 0;
while (pos <= w - k) {
bool b = true;
REP(j,0,k) {
if (a[i][pos+j] == 0) {
b = false;
pos += j + 1;
break;
}
}
if (b) {
REP(j,0,k) {
cout << i+1 << " " << pos+j+1 << endl;
}
pos += 8;
}
}
}
return 0;
}
Submission Info
Submission Time |
|
Task |
A - Multiple Pieces |
User |
unsre |
Language |
C++14 (GCC 5.4.1) |
Score |
67411 |
Code Size |
2081 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 |
3 ms |
256 KB |
subtask_01_02.txt |
AC |
3 ms |
256 KB |
subtask_01_03.txt |
AC |
3 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 |
3 ms |
256 KB |
subtask_01_07.txt |
AC |
3 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 |
3 ms |
256 KB |