Submission #1414688


Source Code Expand

#include <bits/stdc++.h>
using namespace std ;

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

ll w,h,n;
char v[51][51];
vector<string> ans;

string conv(char c,char d){
  return c + " " + d;
}
string conv(int c,int d){
  return to_string(c) + " " + to_string(d);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> w >> h >> n;
  rep(i,w){
    rep(j,h){
      cin >> v[i][j];
    }
  }
  rep(k,50){
    int u = 0;
    while(u < 50){
      string s;
      bool f = true;
      while(v[k][u] == '0'){
        ++u;
      }
      rep(j,8){
        if(!value(k,u+j,50,50)){
          f = false;
        }
        if(value(k,u+j,50,50) && v[k][u +j] == '0'){
          f = false;
          u = u+j;
          break;
        }
        s += conv(k+1,u + j + 1) + "\n";
      }
      if(f){
        u += 7;
        ans.push_back(s);
      }
      ++u;
    }
  }
  cout << ans.size() << endl;
  rep(i,ans.size()){
    cout << ans[i];
  }
  return 0;
}

Submission Info

Submission Time
Task A - Multiple Pieces
User Halksel
Language C++14 (GCC 5.4.1)
Score 67411
Code Size 2058 Byte
Status AC
Exec Time 3 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
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
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 3 ms 256 KB
subtask_01_05.txt AC 3 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 3 ms 256 KB
subtask_01_09.txt AC 3 ms 256 KB
subtask_01_10.txt AC 3 ms 256 KB