結果

問題 No.241 出席番号(1)
ユーザー 184
提出日時 2015-07-10 23:45:04
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 39,552 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-08 02:21:34
合計ジャッジ時間 5,920 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 3
other WA * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         int n;scanf("%d",&n);long long b[101];
      |               ~~~~~^~~~~~~~~
main.cpp:10:41: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         for(int i=0;i<n;i++){int a;scanf("%d",&a);b[i]=~(1<<a);v|=b[i];}
      |                                    ~~~~~^~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
using namespace std;

int main(){
	int n;scanf("%d",&n);long long b[101]; 
	int v=0;
	for(int i=0;i<n;i++){int a;scanf("%d",&a);b[i]=~(1<<a);v|=b[i];}
	for(int i=0;i<n;i++){
		v^=b[i];
		for(int j=0;j<n;j++){
			if(v&(1<<j)){
				printf("%d\n",j);
				v^=(1<<j);
				break;
			}
		}
	} 
	return 0;
}
0