#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") #pragma GCC target("avx2") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("O3") #include using namespace std; using ll = long long; using vi = vector; using vl = vector; using vs = vector; using vc = vector; using vb = vector; using vvi = vector>; using vvvi = vector>>; using vvvvi = vector>>>; using vvl = vector>; using vvvl = vector>>; using vvvvl = vector>>>; using vvc = vector>; using vvb = vector>; using vvvb = vector>>; using vvvvb = vector>>>; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(obj) (obj).begin(),(obj).end() struct Timer{ chrono::steady_clock::time_point st; Timer(){ st = chrono::steady_clock::now(); } // 2sec -> 7e7 times inline double get(){ return chrono::duration(chrono::steady_clock::now() - st).count(); } } tim; struct XorShift{ using result_type = uint32_t; uint64_t x = 2003082720030827ull; inline uint32_t operator()(){ x^=x<<7; x^=x>>9; return (uint32_t)x; } // [0, m) inline uint32_t i(uint32_t m){ return m ? (uint32_t)((uint64_t)(*this)()*m >> 32) : (*this)(); } // [0.0, 1.0) inline double d(){ return (double)((*this)() & 0xFFFFFF) / 16777216.0; } static constexpr uint32_t min() { return 0; } static constexpr uint32_t max() { return UINT32_MAX; } } rnd; // 2sec -> 1e9 times inline bool ac(double start_time, double cur_time, double end_time, double score_dist, double start_temp, double end_temp){ double temp = start_temp + (end_temp - start_temp) * (cur_time - start_time) / (end_time - start_time); // double temp = start_temp * pow(end_temp / start_temp, (cur_time - start_time) / (end_time - start_time)); // end_temp = 0 とすると常に temp = 0 if(score_dist >= 0.0) return true; if(score_dist <= -8.0 * temp) return false; return rnd.d() < exp(score_dist/temp); } // 2sec -> 7e8 times inline double mn_ac(double start_time, double cur_time, double end_time, double start_temp, double end_temp){ double temp = start_temp + (end_temp - start_temp) * (cur_time - start_time) / (end_time - start_time); // double temp = start_temp * pow(end_temp / start_temp, (cur_time - start_time) / (end_time - start_time)); // end_temp = 0 とすると常に temp = 0 return log(rnd.d()) * temp; } const int n = 50, k = 100; uint8_t d[n][n]; void input(){ int tmp; cin >> tmp >> tmp; rep(i,n){ string s; cin >> s; rep(j,n) d[i][j] = s[j] - '0'; } } vector> greedy(){ vector> ans; rep(x,n)if(d[x][25] != 0) ans.push_back({x, 25}); rep(y,n)if(y != 25 && d[25][y] != 0) ans.push_back({25, y}); return ans; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); input(); vector> ans = greedy(); cout << ans.size() << '\n'; for(auto [x, y] : ans) cout << x << ' ' << y << '\n'; return 0; }