結果

問題 No.190 Dry Wet Moist
ユーザー ciel
提出日時 2015-04-22 04:23:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 41 ms / 2,000 ms
コード長 420 bytes
コンパイル時間 419 ms
コンパイル使用メモリ 44,032 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 00:04:21
合計ジャッジ時間 1,882 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d",&N);
      |         ~~~~~^~~~~~~~~
main.cpp:10:34: 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++)scanf("%d",&v[i]);
      |                             ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <vector>
#include <algorithm>
#include <cstdio>
using namespace std;
#define Z(C,D,P)for(R=0,lo=0,hi=N-1;lo<hi;C){for(;lo<hi;D)if(v[lo]+v[hi] P 0)break;if(lo==hi)break;};printf("%d ",R);
int main(){
	int N,R,lo,hi;
	scanf("%d",&N);
	vector<int>v(N*=2);
	for(int i=0;i<N;i++)scanf("%d",&v[i]);
	sort(v.begin(),v.end());
	Z(R++|lo++|hi--,hi--,<)Z(R++|lo++|hi--,lo++,>)Z((v[lo]+v[hi]==0?R++|hi--:1,lo++),hi--,<=)
}
0