提出 #66946002


ソースコード 拡げる

#include <bits/stdc++.h>
#define fs first
#define se second
using namespace std;
#define For(s,e) \
  for(int i=s;i<=e;++i)
#define ForR(s,e) \ 
  for(int i=s;i>=e;--i)
#define FOR(n) \
  for(int i=0;i<n;++i)
#define FORR(n) \ 
  for(int i=n-1;i>=0;--i)
#define IN(a,n) \
  FOR(n){\
    cin>>a[i];\
  }

int main(int /* argc */, char** /* argv */) {
  int n,m;
  cin>>n>>m;
  int a[m];
  for(int i=0;i<m;++i){
    cin>>a[i];
    --a[i];
  }
  int b[n];
  memset(b,0,sizeof(b));
  int s=1;
  for(int k=0;k<m;++k){
    int i=a[k];
    int f1 =(i==0||b[i-1]==b[i]),f2=(i==n-1||b[i+1]==b[i]);
    if(b[i]==0){
      b[i]=1;
    } else{
      b[i]=0;
    }
    int f3 =(i==0||b[i-1]==b[i]),f4=(i==n-1||b[i+1]==b[i]);
    s-=(!f1+!f2);
    s+=(!f3+!f4);
    cout<<(b[0]==1?((s+1)>>1):(s>>1))<<endl;
  }
  return 0;
}

提出情報

提出日時
問題 C - Black Intervals
ユーザ zz050201010
言語 C++ 23 (Clang 16.0.6)
得点 350
コード長 852 Byte
結果 AC
実行時間 557 ms
メモリ 7652 KiB

コンパイルエラー

./Main.cpp:7:20: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
#define ForR(s,e) \ 
                   ^
./Main.cpp:11:18: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
#define FORR(n) \ 
                 ^
2 warnings generated.

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 350 / 350
結果
AC × 3
AC × 29
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 1 ms 3520 KiB
example_01.txt AC 1 ms 3464 KiB
example_02.txt AC 1 ms 3520 KiB
hand_00.txt AC 546 ms 7388 KiB
hand_01.txt AC 543 ms 7396 KiB
hand_02.txt AC 550 ms 7652 KiB
hand_03.txt AC 502 ms 7380 KiB
hand_04.txt AC 1 ms 3500 KiB
hand_05.txt AC 506 ms 5452 KiB
random_00.txt AC 534 ms 5640 KiB
random_01.txt AC 545 ms 7416 KiB
random_02.txt AC 557 ms 6428 KiB
random_03.txt AC 534 ms 5452 KiB
random_04.txt AC 529 ms 5484 KiB
random_05.txt AC 528 ms 5524 KiB
random_06.txt AC 542 ms 5560 KiB
random_07.txt AC 532 ms 5532 KiB
random_08.txt AC 548 ms 6412 KiB
random_09.txt AC 546 ms 6880 KiB
random_10.txt AC 540 ms 5752 KiB
random_11.txt AC 527 ms 5428 KiB
random_12.txt AC 554 ms 6312 KiB
random_13.txt AC 537 ms 5720 KiB
random_14.txt AC 541 ms 5600 KiB
random_15.txt AC 533 ms 5556 KiB
random_16.txt AC 530 ms 5476 KiB
random_17.txt AC 547 ms 6304 KiB
random_18.txt AC 521 ms 5520 KiB
random_19.txt AC 539 ms 5508 KiB