結果
問題 |
No.190 Dry Wet Moist
|
ユーザー |
|
提出日時 | 2015-04-22 04:20:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 406 bytes |
コンパイル時間 | 385 ms |
コンパイル使用メモリ | 43,884 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-05 00:04:10 |
合計ジャッジ時間 | 1,749 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 5 WA * 23 |
コンパイルメッセージ
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]); | ~~~~~^~~~~~~~~~~~
ソースコード
#include <vector> #include <algorithm> #include <cstdio> using namespace std; #define Z(C,P)for(R=0,lo=0,hi=N-1;lo<hi;C){for(;lo<hi;hi--)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--,<)Z(R++|lo++|hi--,>)Z((v[lo]+v[hi]==0?R++|hi--:1,lo++),<=) }