RCO presents 日本橋ハーフマラソン 予選

Submission #1414688

Source codeソースコード

#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

Task問題 A - Multiple Pieces
User nameユーザ名 Halksel
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 67411
Source lengthソースコード長 2058 Byte
File nameファイル名
Exec time実行時間 3 ms
Memory usageメモリ使用量 256 KB

Test case

Set

Set name Score得点 / Max score Cases
test_01 7915 / 1343058 subtask_01_01.txt
test_02 4985 / 1343058 subtask_01_02.txt
test_03 8789 / 1343058 subtask_01_03.txt
test_04 7969 / 1343058 subtask_01_04.txt
test_05 7613 / 1343058 subtask_01_05.txt
test_06 6521 / 1343058 subtask_01_06.txt
test_07 4673 / 1343058 subtask_01_07.txt
test_08 4855 / 1343058 subtask_01_08.txt
test_09 6452 / 1343058 subtask_01_09.txt
test_10 7639 / 1343058 subtask_01_10.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
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