提出 #72033878


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 3e5 + 5;
#define rep(i,j,k,w) for(ll (i) = (j); ((w) > 0) ? ((i) <= (k)) : ((i) >= (k)); (i) += (w))
int n;
int a[N];
int q[N], l = 1, r;
int main(){
	cin >> n;
	rep(i, 1, n, 1)cin >> a[i];
	rep(i, 1, n, 1){
		q[++r] = a[i];
		if(r - l + 1 >= 4 && q[r] == q[r - 1] && q[r - 1] == q[r - 2] && q[r - 2] == q[r - 3]){
			r -= 4;
		}
	}
	cout << r - l + 1;
    return 0;
}  

提出情報

提出日時
問題 C - 1D puyopuyo
ユーザ lichaozhe2022
言語 C++23 (GCC 15.2.0)
得点 300
コード長 471 Byte
結果 AC
実行時間 39 ms
メモリ 5232 KiB

コンパイルエラー

./Main.cpp: In function 'int main()':
./Main.cpp:5:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define rep(i,j,k,w) for(ll (i) = (j); ((w) > 0) ? ((i) <= (k)) : ((i) >= (k)); (i) += (w))
      |                             ^~~
./Main.cpp:11:9: note: in expansion of macro 'rep'
   11 |         rep(i, 1, n, 1)cin >> a[i];
      |         ^~~
./Main.cpp:5:29: note: remove parentheses
    5 | #define rep(i,j,k,w) for(ll (i) = (j); ((w) > 0) ? ((i) <= (k)) : ((i) >= (k)); (i) += (w))
      |                             ^~~
./Main.cpp:11:9: note: in expansion of macro 'rep'
   11 |         rep(i, 1, n, 1)cin >> a[i];
      |         ^~~
./Main.cpp:5:29: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
    5 | #define rep(i,j,k,w) for(ll (i) = (j); ((w) > 0) ? ((i) <= (k)) : ((i) >= (k)); (i) += (w))
      |                             ^~~
./Main.cpp:12:9: note: in expansion of macro 'rep'
   12 |         rep(i, 1, n, 1){
      |         ^~~
./Main.cpp:5:29: note: remove parentheses
    5 | #define rep(i,j,k,w) for(ll (i) = (j); ((w) > 0) ? ((i) <= (k)) : ((i) >= (k)); (i) += (w))
      |                             ^~~
./Main.cpp:12:9: note: in expansion of macro 'rep'
   12 |         rep(i, 1, n, 1){
      |         ^~~

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 21
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3544 KiB
00_sample_01.txt AC 1 ms 3544 KiB
00_sample_02.txt AC 1 ms 3568 KiB
01_random_00.txt AC 1 ms 3520 KiB
01_random_01.txt AC 39 ms 4888 KiB
01_random_02.txt AC 38 ms 4588 KiB
01_random_03.txt AC 34 ms 4432 KiB
01_random_04.txt AC 37 ms 4512 KiB
01_random_05.txt AC 36 ms 4552 KiB
01_random_06.txt AC 36 ms 4548 KiB
01_random_07.txt AC 36 ms 4680 KiB
01_random_08.txt AC 37 ms 4720 KiB
01_random_09.txt AC 36 ms 4640 KiB
01_random_10.txt AC 36 ms 4668 KiB
01_random_11.txt AC 35 ms 4420 KiB
01_random_12.txt AC 38 ms 4164 KiB
01_random_13.txt AC 38 ms 4312 KiB
01_random_14.txt AC 38 ms 4312 KiB
01_random_15.txt AC 38 ms 4312 KiB
01_random_16.txt AC 36 ms 5232 KiB
01_random_17.txt AC 35 ms 4548 KiB