Codeforces Round #581 DIV2 C問題 - Anna, Svyatoslav and Maps

Source

Codeforces Round #581 DIV2 C問題 (1250pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20190820-1)のコード

C++に変換後のコードはこちら

//no-unlocked
int N, M, P[1d6];
int dist[100][100];

char c;
int res[1d6], ress;
{
  int i, j, k;
  
  rd(N);
  rep(i,N) rep(j,N) dist[i][j] = int_inf;
  rep(i,N) dist[i][i] = 0;
  rep(i,N) rep(j,N){
    rd(c);
    if(c=='1') dist[i][j] = 1;
  }
  rep(k,N) rep(i,N) rep(j,N) dist[i][j] <?= dist[i][k] + dist[k][j];

  rd(M,(P--)(M));

  res[ress++] = P[0];
  i = 0;
  while(i < M - 1){
    j = i;
    while(j+1 < M && dist[P[i]][P[j+1]] == (j+1) - i) j++;
    res[ress++] = P[j];
    i = j;
  }

  wt(ress);
  wt(res(ress)+1);
}

Current time: 2024年04月20日02時58分56秒
Last modified: 2019年08月21日05時02分24秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF581 CF_Div2_C
トップページに戻る

Logged in as: unknown user (not login)

ログイン: