保存されている過去のバージョンの一覧

2019年11月23日18時50分05秒

Codeforces Round #600 DIV2 B問題 - Silly Mistake

Source

Codeforces Round #600 DIV2 B問題 (1000pt)
Problem description

問題概要

省略

解法

省略

cLayversion 20191123-1)のコード

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

//no-unlocked
int N, A[1d5];
int sz, in[1000001];
int ress, res[1d5], sts, st[1d5];
{
  rd(N,A(N));

  rep(i,N){
    if(A[i] < 0){
      A[i] *= -1;
      if(in[A[i]]!=1) wt(-1), return 0;
      sz--;
    } else {
      if(in[A[i]]!=0) wt(-1), return 0;
      sz++;
    }
    in[A[i]]++;
    st[sts++] = A[i];

    if(sz==0){
      res[ress++] = i+1;
      while(sts) in[st[--sts]] = 0;
    }
  }
  if(sz) wt(-1), return 0;

  rrep(i,1,ress) res[i] -= res[i-1];
  wt(ress);
  wt(res(ress));
}

Current time: 2024年04月21日01時21分30秒
Last modified: 2019年11月23日18時50分05秒 (by laycrs)
Tags: Competitive_Programming_Incomplete Codeforces CF600 CF_Div2_B
トップページに戻る

Logged in as: unknown user (not login)

ログイン: