Submission #1140725


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

bool rest[50][50];


const int dx[] = {1,0,-1,0};
const int dy[] = {0,1,0,-1};

int main(){
  vector<vector<pii>> yo;
  while(true){
    int bx=-1,by;
    REP(i,50)if(bx==-1)REP(j,50)if(!rest[i][j]){
      bx=i;by=j;break;
    }
    if(bx==-1)break;
    vector<pii> po;
    po.push_back(pii(bx,by));
    rest[bx][by]=true;
    bool ook = true;
    REP(_,7){
      int tx,ty;
      bool ok = false;
      REP(d,4){
        tx=bx+dx[d];
        ty=by+dy[d];
        if(tx<0||ty<0||tx>=50||ty>=50)continue;
        if(rest[tx][ty])continue;
        ok = true;
        rest[tx][ty]=true;
        bx=tx;
        by=ty;
        po.push_back(pii(bx,by));
        break;
      }
      if(!ok){
        ook = false;
        break;
      }
    }
    if(ook)yo.push_back(po);
    else break;
  }
  printf("%d\n",(int)yo.size());
  REP(i,yo.size()){
    for(pii P : yo[i]){
      printf("%d %d\n",P.second+1, P.first+1);
    }
  }
  return 0;
}

Submission Info

Submission Time
Task A - Multiple Pieces
User rickytheta
Language C++14 (GCC 5.4.1)
Score 51458
Code Size 1851 Byte
Status AC
Exec Time 2 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 5336 / 1343058 3884 / 1343058 5608 / 1343058 5557 / 1343058 5195 / 1343058 5846 / 1343058 4632 / 1343058 4023 / 1343058 6409 / 1343058 4968 / 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 2 ms 256 KB
subtask_01_02.txt AC 2 ms 256 KB
subtask_01_03.txt AC 2 ms 256 KB
subtask_01_04.txt AC 2 ms 256 KB
subtask_01_05.txt AC 2 ms 256 KB
subtask_01_06.txt AC 2 ms 256 KB
subtask_01_07.txt AC 2 ms 256 KB
subtask_01_08.txt AC 2 ms 256 KB
subtask_01_09.txt AC 2 ms 256 KB
subtask_01_10.txt AC 2 ms 256 KB