結果

問題 No.29 パワーアップ
コンテスト
ユーザー ytft
提出日時 2022-11-03 22:00:13
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 5,000 ms
コード長 278 bytes
コンパイル時間 2,783 ms
コンパイル使用メモリ 274,056 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-10-24 21:18:46
合計ジャッジ時間 3,568 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |         scanf("%d",&N);
      |         ~~~~~^~~~~~~~~
main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |                 scanf("%d",&index);
      |                 ~~~~~^~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main(){
	int N,index,sum=0,count[10]={0},ans=0;
	scanf("%d",&N);
	for(int i=0;i<3*N;++i){
		scanf("%d",&index);
		ans+=count[index-1];
		sum+=1-2*count[index-1];
		count[index-1]=1-count[index-1];
	}
	printf("%d\n",ans+sum/4);
}
0